• 中文交流区
  • 当OpenResty返回403 Forbidden状态码时,会在页面底部显示一个默认的OpenResty信息,这个openresty字段怎么去掉

5 days later

在 nginx.conf 的 http 段添加 server_tokens off; 试下。

a month later

xlibor
这个默认就是有添加的。server_tokens off; 在nginx里是限期版本信息。

    楼主这个解决了吗?其实我想着是否可以把403这个界面进行自定义?

      去掉 openresty 需要修改源码涉及到文件
      src/core/nginx.h
      src/http/ngx_http_header_filter_module.c
      src/http/ngx_http_special_response.c
      src/http/v2/ngx_http_v2_filter_module.c

      自定义错误页面 使用 error_page

              error_page  403 /403.html;
              location /403.html {
                  default_type text/html;
                  charset utf-8;
                  root /tmp/403/;
              }
        Write a Reply...