Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k views
in Technique[技术] by (71.8m points)

关于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,第一次重启不报错了,现在又还是这样,这是什么原理啊,大佬们谁知道.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...