以下nginxconfiguration服务http://alpha.mydomain/mypath/test罚款,但在http://alpha.mydomain/mypath/test/与500内部服务器错误失败。 注意第二个URL末尾的斜杠。
该应用程序是HTML5应用程序,因此意图是为所有/ mypath /path提供index.html,并让客户端处理逻辑。
server { listen *:80; server_name alpha.mydomain.com beta.mydomain.com; location ~ ^/mypath/.*$ { default_type text/html; # fix for octet stream coming back sometimes alias /home/ubuntu/myproject-web/index.html; add_header Content-Type text/html; } location / { alias /home/ubuntu/myproject-web/; } }
也许不是一个修复本身,但您可以通过添加以下行到您的configuration解决此问题:
rewrite (.*)/$ $1;