#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 html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0....
你可以在这些配置文件中查找error_page指令,确保404错误的自定义页面(如果有的话)已经正确设置。例如: nginx http { ... server { ... error_page 404 /404.html; location = /404.html { internal; } ... } ... } 如果没有自定义404页面,Nginx将使用默认的404错误页面。 查看访问日志,找出产生404...
error_page 404 = @404; # 定义404处理器 location @404 { # 设置内容类型为JSON default_type application/json; # 输出JSON格式的404响应 return404'{"error":"Not Found"}'; } } } }
错误页面配置 错误页面的配置指令为error_page,格式如下: 代码语言:javascript 代码运行次数:0 运行 AI代码解释 error_page code...[=[response]]uri; code表示响应码,可以同时配置多个;uri表示错误页面,一般为服务器上的静态资源页面。 例如,下面的例子分别为404、500等错误码设置了错误页面,具体设置如下: 代码语...
error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 页面 3、Openresty配置 #include /etc/nginx/conf.d/*.conf; ...
error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } 检测Nginx配置是否正确 /usr/sbin/nginx -t 重启Nginx /usr/sbin/nginx -s reload 验证Lua配置是否成功 tail -f access.log tail -f access.index.log
error_page500502503504/50x.html; location= /50x.html { root html; } # proxy the PHP scripts to Apache listening on127.0.0.1:80# #location~\.php$ { # proxy_pass http://127.0.0.1;#} # pass the PHP scripts to FastCGI server listening on127.0.0.1:9000# ...
问Openresty/Lua返回默认错误页面而不是自定义页面EN今天一位客户说网站错误页面返回的状态码是302而不是...
{roothtml;indexindex.htmlindex.htm;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass http://...
{root html;index index.html index.htm;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page500502503504/50x.html;location=/50x.html{root html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {# proxy_pass ...