建议选择homebrew安装,安装完成后会显示基本信息,后续如果要重新查看可通过命令实现。 brew install nginx 安装 brew info nginx 查看信息
1 2 3 4 5 6 7 8 9 10 11 12 13
Docroot is: /opt/homebrew/var/www
The default port has been setin /opt/homebrew/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo.
nginx will load all files in /opt/homebrew/etc/nginx/servers/.
To restart nginx after an upgrade: brew services restart nginx Or, if you don't want/need a background service you can just run: /opt/homebrew/opt/nginx/bin/nginx -g daemon off;
Options: -?,-h : this help -v : show version and exit -V : show version and configure options thenexit -t : test configuration and exit -T : test configuration, dump it and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: /opt/homebrew/Cellar/nginx/1.23.1/) -e filename : set error log file (default: /opt/homebrew/var/log/nginx/error.log) -c filename : set configuration file (default: /opt/homebrew/etc/nginx/nginx.conf) -g directives : set global directives out of configuration file
报错处理
1 2 3 4 5
nginx: [alert] could not open error log file: open() "/opt/homebrew/var/log/nginx/error.log" failed (13: Permission denied) nginx: the configuration file /opt/homebrew/etc/nginx/nginx.conf syntax is ok nginx: [emerg] open() "/opt/homebrew/var/log/nginx/access.log" failed (13: Permission denied) 2022/10/02 15:21:54 [emerg] 50876#0: open() "/opt/homebrew/var/run/nginx.pid" failed (13: Permission denied) nginx: configuration file /opt/homebrew/etc/nginx/nginx.conf test failed