您好我想獲得一個自定義502網頁在網站上工作,似乎無法得到它的工作。nginx + uwsgi自定義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;
}
}
好了,所以我改變了它的樣子這......'root/home/ployio/public_html; index index.html index.htm index.php; error_page 500 502 503 504 /502.html; 位置/502.html { root/home/ployio/public_html; }' – 2012-04-01 17:03:23
它仍然無法正常工作。 – 2012-04-01 17:09:46
嘗試在error_page指令中更具體。使用'error_page 502/502.hml'。如果您將502.html文件重命名爲50x.html,您的原始nginx配置也可能會起作用。 – ygneo 2012-04-01 17:23:46