自定义502错误页面nginx与独angular兽不工作,使我疯狂;)

我尝试了几次,并多次尝试修复与独angular兽nginx下面的代码,但它只是没有工作。 所以现在在上次的报告里这里张贴一些更有才华的人可以看到我的错误,其他人也可以从中受益。

我在用着:

  • nginx的
  • 独angular兽

问题是

  • 没有显示502错误(我使用cap deploy:web:禁用任务来编写maintenance.html)
  • 如果nginx正在运行,但独angular兽也不是即时获取502错误页面

nginxconfiguration:

upstream unicorn { server unix:/srv/books/shared/tmp/unicorn.sock fail_timeout=0; } server { listen 80 deferred; server_name books.*; client_max_body_size 4G; keepalive_timeout 10; server_tokens off; root /srv/books/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; } } 

error_page指令放在server下,而不是location