报错描述:

nginx报错:nginx: [alert] could not open error log file: open() “/usr/local/nginx/logs/error.log“ faile

解决方案:

将 /user/local 目录下的 nginx 的目录和里面的东西全部授权权限

如果 nginx 目录下没有 logs 那么需要创建一个并赋权限

image_2023-01-28-09-47-13

报错描述:

nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

原因:当前用户对该位置没有写入权限所导致的,如果使用 sudo 来执行的话就不会抱任何错误

解决方案:使用命令: sudo chmod -R a+rw /usr/local/nginx

  • 在执行上面操作时所需要注意事项:个人学习,不考虑安全问题 重点

如果要以非 root 用户或者权限启动 Nginx 则会出现报错: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

解决方案:

将 nginx 目录中的 conf/nginx.conf 文件中的 80 端口改为 1024 以上的端口号

server {
#      listen       80;
       listen       8080;

       server_name  localhost;

       #charset koi8-r;

       #access_log  logs/host.access.log  main;

       location / {
           root   html;
           index  index.html index.htm;
  }

image_2023-01-28-10-09-00

再次执行 ./nginx

image_2023-01-28-10-09-16

更新于 阅读次数

请我喝[茶]~( ̄▽ ̄)~*

D 微信支付

微信支付

D 支付宝

支付宝

D 贝宝

贝宝