关于nginx报错和配置的问题

nginx.conf
如下配置为啥不生效


    location / {
        root   /usr/share/nginx/html/public;
        index  index.html index.htm;
    }
    location = /abc {
        root /usr/share/nginx/html/abc;
        index index.html;
    }
    # 或者
    location /abc {
        root /usr/share/nginx/html/abc;
        index index.html;
    }
    
     location / {
        root   /usr/share/nginx/html/public;
        index  index.html index.htm;
    }

访问域名根目录没什么问题,域名根目录/abc貌似映射失败404啊,网上搜的这么配都不行啊

还有为啥每次sudo systemctl restart nginx再sudo systemctl status nginx都报这个错

Can't open PID file /var/run/nginx/nginx.pid (yet?) after start: No such file or directory
image

实际上这个路径下是有nginx.pid的,默认是/var/run/nginx.pid,改了加了一层/nginx,第一次重启不报错了,现在又还是这样,这是什么原理啊,大佬们谁知道.

阅读 3k
1 个回答

image.png
文件或文件夹路径不存在

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题