Nginx try_files在文件存在时返回默认错误



当应用程序关闭时,Nginx返回默认错误页面,而不是我指定的页面。我发送maintenance.html做错了什么?

我得到了这个Nginx配置的服务器:

server {
listen 443 ssl;
ssl_certificate     /root/certs/cert.crt;
ssl_certificate_key /root/certs/cert.key;
server_name example.com;

error_page 500 501 502 503 504 505 506 507 508 510 511 @maintenance;

location / {    
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:3000;
}
location @maintenance {
root /var/html;
try_files /maintenance.html =404;
}
}

好了,我明白了。将maintenance.html/var/html移动到/usr/share/nginx/html,它工作(可能是一个权限错误)

最新更新