环境:
- uwsgi
- nginx
- django 1.3
我正在使用www.example.com
带有 Django 和 nginx 的域,我想通过 访问 Django www.example.com/abc/
,但我不知道如何设置子目录。
这是 nginx 配置文件:
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;
}
}
当我打开网站www.example.com/abc/
时,djangourls.py
不匹配,它只匹配^index$
.
如何修改 nginx 位置以将 django 设置为www.example.com/abc
?