Environment:
- uwsgi
- nginx
- django 1.3
I'm using the domain www.example.com
with Django and nginx, and I want to access the Django by www.example.com/abc/
, but I don't know how to set the subdirectory.
This is the nginx conf file:
server {
listen 80;
server_name www.example.com;
error_log /var/log/nginx/xxx.error_log info;
root /home/web/abc; # this is the directory of the django program
location ~* ^.+\.(jpg|jpeg|png|gif|css|js|ico){
root /home/web/abc;
access_log off;
expires 1h;
}
location ~ /abc/ { # I want to bind the django program to the domian's subdirectory
include uwsgi_params;
uwsgi_pass 127.0.0.1:9000;
}
}
When I open the website www.example.com/abc/
, the django urls.py
doesn't match, it only match the site like ^index$
.
How can I modify the nginx location to set django to www.example.com/abc
?