我使用自制软件安装了Nginx ,完成安装后,显示以下消息:
In the interest of allowing you to run `nginx` without `sudo`, the default
port is set to localhost:8080.
If you want to host pages on your local machine to the public, you should
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
any other web servers running port 80, of course.
You can start nginx automatically on login running as your user with:
mkdir -p ~/Library/LaunchAgents
cp #{prefix}/org.nginx.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.nginx.nginx.plist
Though note that if running as your user, the launch agent will fail if you
try to use a port below 1024 (such as http's default of 80.)
但是我想让 Nginx在端口80上运行,并且在登录时运行,并且我不想打开终端并键入sudo nginx
来执行此操作。我希望它从Redis和PostgreSQL这样的plist文件加载。
我将plist /Library/LaunchAgents/
从等效的用户文件夹移至,并更改了其所有权,还尝试user
在nginx.conf
文件中设置伪指令,并且在Console.app中仍然显示相同的错误消息:
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
(以及另一条消息告诉我,由于nginx
该user
命令是在没有超级用户特权的情况下运行的,因此该指令被忽略了)