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

来源:2-11 Nginx的目录和配置语法_默认配置与默认站点启动

慕粉3838620

2017-11-02

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

写回答

2回答

慕粉3838620

提问者

2017-11-03

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

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
0

Jeson

2017-11-02

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

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

0
2
慕粉3838620
我知道了 忘了在default里面加404
2017-11-03
共2条回复

Nginx入门到实践-Nginx中间件应用+搭建Webserver架构

中间件、负载均衡、应用层安全防护、动静分离、Nginx+LUA开发等

4183 学习 · 908 问题

查看课程