本软件利用brew安装,一切命令都在终端操作。
1、搜索(可省略)
brew search nginx
2、下载
brew install nginx


3、打开
sudo nginx
4、验证是否启动正常
如果出现下图,证明nginx已经启动成功!

5、测试配置是否有语法错误
nginx -t
6、安装过程中问题处理:
<问题一>nginx: [emerg] bind() to 0.0.0.0:80 failed (48: Address already in use)

该问题是由于8080端口已经被占用;
(1)、查找占用8080端口应用:
ps -ef | grep nginx

(2)、杀死进程
kill -9 xxx

(3)、稍候,重启nginx即可

<问题二>nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)

该问题是由于当前用户没有权限写入
7、补充
常用的指令有:
nginx -s reload 重新加载配置
nginx -s reopen 重启
nginx -s stop 停止
nginx -s quit 退出
nginx -V 查看版本,以及配置文件地址
nginx -v 查看版本
nginx -c filename 指定配置文件
nginx -h 帮助
网友评论