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