请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

nginx reload 之后访问不存在的网页还是404

我按照视频上的操作修改50x.html之后 systemctl reload nginx.service 然后访问一个不存在的地址还是报404的错误 而不是刚才50x.html中修改的页面

正在回答 回答被采纳积分+3

2回答

提问者 慕粉3838620 2017-11-03 20:50:44

下面是我的配置文件和错误日志

default.conf:

server {

    listen       80;

    server_name  localhost;


    #charset koi8-r;

    #access_log  /var/log/nginx/host.access.log  main;


    location / {

        root   /usr/share/nginx/html;

        index  index.html index.htm;

    }


    #error_page  404              /404.html;


    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {

        root   /usr/share/nginx/html;

    }


    # proxy the PHP scripts to Apache listening on 127.0.0.1:80

    #

    #location ~ \.php$ {

    #    proxy_pass   http://127.0.0.1;

    #}


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    #

    #location ~ \.php$ {

    #    root           html;

    #    fastcgi_pass   127.0.0.1:9000;

"/etc/nginx/conf.d/default.conf" 45L, 1093C 

error.log:

[root@localhost test]# tail -f /var/log/nginx/error.log 

2017/11/03 20:32:05 [error] 1274#1274: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.1.101, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.116", referrer: "http://192.168.1.116/"

2017/11/03 20:32:23 [error] 1274#1274: *3 open() "/usr/share/nginx/html/hsdfdsf.html" failed (2: No such file or directory), client: 192.168.1.101, server: localhost, request: "GET /hsdfdsf.html HTTP/1.1", host: "192.168.1.116"


0 回复 有任何疑惑可以回复我~
Jeson 2017-11-02 23:08:19

这个问题,最好把Nginx 的配置文件给我看看。

当然,也建议你看下Nginx的错误日志。一起贴出来。

0 回复 有任何疑惑可以回复我~
  • 提问者 慕粉3838620 #1
    我把日志粘贴在新的评论中了
    回复 有任何疑惑可以回复我~ 2017-11-03 20:51:22
  • 提问者 慕粉3838620 #2
    我知道了 忘了在default里面加404
    回复 有任何疑惑可以回复我~ 2017-11-03 20:54:28
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信