【发布时间】:2012-04-01 14:34:49
【问题描述】:
您好,我正在尝试让自定义 502 页面在网站上运行,但似乎无法正常运行。
基本上我测试它的方式是我只是停止 uwsgi 并访问页面,每次我得到默认的 nginx 502 页面。有人可以向我解释如何让它工作吗?我已经在这里工作了一个多星期,但成功率为 0。我在 public_html 中有一个名为 502.html 的文件,我可以使用http://ask.ploy.io/502.html 直接访问它,但是一旦我停止 uwsgi 并尝试访问主域http://ask.ploy.io,我就会得到默认的 502 页面。这是虚拟主机配置:
### nginx vhost conf for ployio
server {
listen 80;
server_name ask.ploy.io www.ask.ploy.io;
access_log /usr/local/apache/domlogs/ask.ploy.io main;
error_log /home/ployio/access-logs/ask.ploy.io debug;
root /home/ployio/public_html;
index index.html index.htm index.php;
location /502.html {
root /home/ployio/public_html;
}
location ~ /\.ht {
deny all;
}
location / {
error_page 404 403 = @uwsgi;
log_not_found off;
error_page 502 /502.html;
root /home/ployio/public_html;
}
location @uwsgi {
internal;
uwsgi_pass unix:/home/ployio/.uwsgi/uwsgi.sock;
include /usr/local/nginx/conf/uwsgi_params;
}
location ~* ^.*\.php$ {
if (!-f $request_filename) {
return 404;
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://204.61.223.114:8888;
}
location /cpanel {
rewrite ^/(.*) https://cpanel.ask.ploy.io:2083/$1 permanent;
}
}
【问题讨论】: