mac brew install nginx遇到的坑
默认使用 brew install nginx 出现了一下的错误:
localhost:testdj newstart$ brew install nginx
==> Installing dependencies for nginx: openssl, pare
==> Installing nginx dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2n.high_sierra.
######################################################################## 100.0%
==> Pouring openssl-1.0.2n.high_sierra.bottle.tar.gz
Error: Failed to create /usr/local/opt/openssl
Things that depend on openssl will probably not build.
Could not symlink .
/usr/local/opt is not writable.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall openssl`
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
? /usr/local/Cellar/openssl/1.0.2n: 1,792 files, 12.3MB
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.41.high_sierra.bottl
######################################################################## 100.0%
==> Pouring pcre-8.41.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink .
/usr/local/opt is not writable.
You can try again using:
brew link pcre
==> Summary
? /usr/local/Cellar/pcre/8.41: 204 files, 5.3MB
==> Installing nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.12.2_1.high_sierra.
######################################################################## 100.0%
==> Pouring nginx-1.12.2_1.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink .
/usr/local/opt is not writable.
You can try again using:
brew link nginx
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall nginx`
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
nginx
==> Summary
? /usr/local/Cellar/nginx/1.12.2_1: 25 files, 1MB
localhost:testdj newstart$ /usr/local/webserver/nginx/sbin/nginx -v
-bash: /usr/local/webserver/nginx/sbin/nginx: No such file or directory
localhost:testdj newstart$ /usr/local/Cellar/nginx/sbin/nginx -v
-bash: /usr/local/Cellar/nginx/sbin/nginx: No such file or directory
localhost:testdj newstart$ brew postinstall nginx
==> Postinstalling nginx
Error: Permission denied @ dir_s_mkdir - /usr/local/etc
localhost:testdj newstart$ sudo chown -R $(whoami) /usr/local/etc/
chown: /usr/local/etc/: No such file or directory
localhost:testdj newstart$ sudo chown -R $(whoami) /usr/local
chown: /usr/local: Operation not permitted
localhost:testdj newstart$ sudo chown -R $(whoami) /usr/local/
chown: /usr/local/: Operation not permitted
localhost:testdj newstart$ nginx
-bash: nginx: command not found
localhost:testdj newstart$ sudo nginx
sudo: nginx: command not found
localhost:testdj newstart$
然后就是浩浩荡荡的解决之路:
首先如果出现一些目录没有权限的问题:直接使用 sudo chown -R $(whoami) /usr/local/opt(这个目录就是需要赋予权限的目录),往后所有需要给目录赋权限的使用,直接使用这个,比如,提示Error: Failed to create /usr/local/opt/openssl 直接使用上面的命令
1. openssl 无法link成功
在试过很多方法之后,比如 添加 --force 参数,仍旧无解的情况下,google给了我希望
删除 /usr/local/Cellar/openssl路径,可是删除之后重新使用 brew install openssl 仍旧失败
继续,删除 rm -rf /usr/local/opt/openssl
重新使用 brew install openssl。成功
2. 启动nginx 仍旧失败
查看只有发现是 没有 link pcre
使用命令:brew link pcre
3. 这样修改之后,仍旧失败
启动后,显示
nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (2: No such file or directory)
2017/12/26 15:47:00 [emerg] 36666#0: open() "/usr/local/nginx/conf/nginx.conf" failed (2: No such file or directory)
这个时候,执行 brew postinstall nginx
解决
4. 访问 localhost:8080 显示成功
转载于:https://www.cnblogs.com/loveyangaddddd/p/8118501.html
mac brew install nginx遇到的坑相关推荐
- mac brew install Error: No available formula with the name “*“的解决办法
在用brew install命令安装apt-get或者yum等命令的时候会报如下错: 解决方法: rm -rf /usr/local/Homebrew/Library/Taps/homebrew/ho ...
- mac nginx 非brew安装_Mac下使用Home Brew安装Nginx
mac使用brew安装nginx记录 服务器上用nginx + tomcat做了负载均衡,在本地开发时图片等一系列文件上传操作多有不便, 想着本地也安装一个nginx,映射一下静态资源目录以便和项目分 ...
- brew install php55redis,Mac下安装LNMP环境
Mac下搭建lamp开发环境很容易,有xampp和mamp现成的集成环境.但是集成环境对于经常需要自定义一些配置的开发者来说会非常麻烦,而且Mac本身自带apache和php,在brew的帮助下非常容 ...
- mac下使用brew安装nginx
安装 brew install nginx 启动 brew services start nginx 停止 brew services stop nginx 重启nginx brew services ...
- mac使用brew安装nginx并使用
文章目录 安装brew 使用brew安装nginx 查看nginx版本 启动nginx 查看nginx配置 修改nginx配置文件 方式1-命令行 方式2-找到并打开配置文件 配置nginx入口 .n ...
- 在Mac上使用Nginx和FastCGI部署Flask应用
最近在学习Flask,本文介绍一下如何部署Flask开发的应用,同时也学习一下Nginx的使用,这只是在Mac上的一个实验. 应用 这里使用的应用就是官方的文档中给出的Flaskr. 安装Nginx ...
- MacOS开发必备工具brew,安装nginx反向代理,替代linux工具 apt-get和 yum...
Mac os开发者必备工具 brew,替代Linux系统中的 apt-get和yum工具,本文介绍Mac电脑安装Homebrew,并下载安装软件nginx反向代理过程. 1.安装Homebrew 在苹 ...
- nginx mac 服务器 html,Mac上搭建 nginx 服务器
因为需要做一个自己的内测分发平台,所以需要搭建一台自己的服务器,于是我选择了使用它 nginx 来搭建服务器,很方便,很简单. 本文主要讲一下如何在 mac 上搭建 nginx 服务器,已经一些简单的 ...
- ant centos环境下 编译没有将配置文件加载_你可能忽略的macOS下brew安装nginx细节解读,干货
大家好,我是路程lucky,热爱开发.设计.学习.生活.爱捣鼓的web前后端工程师,为您带来原创文章,欢迎持续关注~ 今天我们聊一聊macOS下的brew安装nginx,本文重点关注的是安装的细节的解 ...
最新文章
- 微型数据中心正在向边缘发展
- 编程之美系列之三——计算1的个数
- 为何excel中数据无法计算机,excel表格内数据为何无法计算机-为什么EXCEL单元格内的数字不能运算...
- 从云计算到低延时,传统编码器与创新技术双剑合璧严把成本质量关
- 老男孩shell实战读书笔记 (6-10章节)
- 阐述HTML语言的基本语法规则,HTML基本语法和语义写法规则与实例
- 李彦宏站台的世界首家 AI 公园就有啥?怎么去?
- git向远程推送代码提示fatal: Authentication failed
- 计算机组成原理408
- css 图片反色,颜色反色,高斯模糊
- android实现箭头流程列表_Android弹出选项框及指示箭头动画选择
- 搜湖州师范学院C语言题库,湖州师范学院文件-20210402175834.doc-原创力文档
- 微信小程序给echarts图表动态赋值
- Ubuntu安装搜狗输入法后修改默认英文输入状态的方法
- 英语足球foteball运动
- ZLS_CAS 5x版本使用http协议
- php imagecreate 中文,imagecreate
- python循环基本语法
- Arduino与Proteus仿真实例-DHT11温度湿度传感器驱动仿真
- 网卡Inter (R) Wi-Fi 6 AX201突然故障 错误代码10,无法找到无线网络,蓝牙也无效了
热门文章
- linux下根据端口查进程,linux根据进程查端口,根据端口查进程
- 泛型类有什么作用_3 分钟带你彻底搞懂 Java 泛型背后的秘密
- 【Pytorch神经网络理论篇】 12 卷积神经网络实现+卷积计算的图解
- 五、手动取消ajax请求 解决重复发送请求问题
- pip install 时报错 ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问(已解决)
- LeetCode 2177. 找到和为给定整数的三个连续整数
- LeetCode 2138. 将字符串拆分为若干长度为 k 的组
- LeetCode 1278. 分割回文串 III(区间DP)
- 牛客 牛牛的独特子序列(双指针/二分查找)
- 05.序列模型 W3.序列模型和注意力机制