秦时明月之君临天下 2019-12-09 17:22 采纳率: 0%
浏览 1396
已结题

Nginx配置404页面无效

主要的相关配置:

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    # fastcgi_intercept_errors on | off;
    # 启用自定义错误页面
    fastcgi_intercept_errors on; 

    server {
        listen       80;
        server_name  localhost;

        charset utf8;

        access_log  logs/80-access.log  main;
        error_log  logs/80-error.log error;

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

        # 使用腾讯公益404页面
        error_page  404              /404.html;
        location = /404.html {
            root   html;
        }

        # error_page 404 = http://www.test.com/error.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}

注:404.html和50x.html都在html文件夹下,404页面无效,还是默认的界面如下:
file

  • 写回答

2条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      问题事件

      • 已结题 3月23日

      悬赏问题

      • ¥15 MySQL行转动态列的问题
      • ¥15 通过STM32F4实现智能清洁小车,要求用到三个以上传感器
      • ¥15 perl代码解释说明
      • ¥15 列举 五阶幻方 有多少种
      • ¥15 请教一下能人在VS中调用MATLAB绘制动态驻波
      • ¥15 VB.NET如何调用Microsoft Excel?(WPS存在时)
      • ¥15 KUKA机器人EtherNetIP通讯配置教程
      • ¥15 VB6.0如何模拟键盘组合按键
      • ¥15 python怎么替换这个word里边内容
      • ¥15 做谷歌浏览器插件的时候,怎么在background.js中优先执行其他.js文件里面函数呀?