阿里云1000元通用代金券点此领取
直接上配置文件
server { listen 80 default; # 要禁止直接访问ip,需要加上default server_name ~.*; error_page 404 400 402 401 /404.html; # 定义错误状态码对应的html文件 location = /404.html { # 如果使用相对路径一般将文件放在nginx安装目录下的html/下,比如:/usr/local/nginx/html/404.html root html; } error_page 500 /500.html; location = /500.html { root html; } error_page 502 /502.html; location = /502.html { root html; } location / { # 这里必须这样写访问ip才能跳转到自定义的500.html return 500; } #return 500; # 如果这样写,会跳转到nginx默认的500页面 }这是写 return 500;的结果
这是 location的