场景

nginx普通用户使用80端口启动失败

bind() to 0.0.0.0:80 failed (13: Permission denied)

解决

cd /usr/local/nginx/sbin/ 
chown root nginx
chmod u+s nginx

命令解释:

chown root nginx:将 nginx 文件的所有者设置为 root 用户。
chmod u+s nginx:为 nginx 文件设置 SUID 位,这意味着无论谁运行这个文件,它都会以文件所有者(即 root 用户)的身份运行。
Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐