[Django]-Django and Nginx try_files 403 for site root page

5👍

Add this


location = / {
rewrite ^(.*)$ /index.htm last;
}

underneath the root line to do a rewrite of the URI before further processing.

PS. You have probably sorted this out during the year since your asked, but here it is for other to see.

👤Kalle

1👍

A better solution is you provide a / url in your urls.py is remove the

 root /var/www/$2/htdocs;

Then only include the root in location {} blocks where you serve up static assets.

👤Mike

Leave a comment