1

The following nginx config serves http://alpha.mydomain/mypath/test fine, however fails on http://alpha.mydomain/mypath/test/ with 500 Internal Server Error. Notice the slash in the end of the second URL.

The app is HTML5 application therefore the intent is to serve index.html for all /mypath/ paths and let the client side handle the logic.

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/;
}

}
4
  • 1
    Exactly how does it "fail"? Feb 17, 2014 at 22:59
  • 1
    500 Internal Server Error Feb 17, 2014 at 23:34
  • 1
    What's in nginx's error log, then? Feb 17, 2014 at 23:35
  • 1
    "/home/ubuntu/myproject-web/index.htmlindex.html" is not a directory Feb 18, 2014 at 0:03

1 Answer 1

0

Maybe not a fix per se, but you can work around this issue by adding the following line to your config:

rewrite (.*)/$  $1;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .