自定义502糟糕的gataway为Nginx,不能得到它的工作,最新怎么了?

我试图用独angular兽赶上一个502糟糕的gataway nginx 独angular兽运行时引发此错误。 我试图使用自定义错误页面,而不是独angular兽运行无效。

我错过了什么? 根据文件这应该是正确的,我只是没有看到任何错误。

上游独angular兽{服务器unix:/srv/host/shared/tmp/unicorn.sock fail_timeout = 0; }

server { listen 80 deferred; server_name host.com host.com client_max_body_size 4G; keepalive_timeout 10; root /srv/host/public; location / { try_files /system/maintenance.html $uri/index.html $uri @unicorn; } try_files $uri/index.html $uri @unicorn; location @unicorn { error_page 502 /system/maintenance.html; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://unicorn; } } 

我的nginx error.log显示:

  unix:/srv/host/shared/tmp/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 83.117.60.95, server: host.com, request: "GET / HTTP/1.1", upstream: "http://unix:/srv/host/shared/tmp/unicorn.sock:/", host: "host.com" 

是的,你可以在nginx中定制错误页面。 向你的configuration添加如下内容:

 error_page 502 /path/to/error-pages/502_bad_gateway.html;