Reputation: 7275
I am serving static html with nginx.
I'd like mydomain.com to show index.html in the root folder. For links of the form /pages/page
I want them to go to the root directory and pull up page.html
from the pages folder.
Here's what I came up with:
location / {
root /var/www/public_html;
index index.html;
try_files $uri $uri.html http://mysite.com;
}
However, I get a 404 when I go to my site. It does render index.html if I use try_files /index.html $uri $uri.html http://mysite.com;
Upvotes: 0
Views: 780
Reputation: 7275
I have to use try_files $uri $uri/index.html $uri.html http://mysite.com;
. I thought the index directive was enough..
Upvotes: 1