【发布时间】:2014-02-25 05:33:43
【问题描述】:
我想在同一个 django 应用和同一个 nginx 服务器上运行多个网站。 我成功运行 http://myip/ 和 http://myip/name1 和 http://myid/name2
现在我想将所有这些项目链接到 myname.com 和 name1.com 和 name2.com
我应该如何更改我的 nginx 配置文件?该文件的当前版本如下所示。谢谢
upstream crsq {
server localhost:8000;
}
server {
listen 80 default;
access_log /home/ubuntu/crsq-access.log;
error_log /home/ubuntu/crsq-error.log error;
# Make site accessible from http://localhost/
server_name crsq;
location @proxy_to_crsq_app {
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http: //crsq;
}
location /robots.txt {
alias /home/ubuntu/crsq/crsq/robots.txt;
}
location / {
try_files $uri @proxy_to_crsq_app;
}
location /static {
alias /home/ubuntu/crsq/crsq/static;
}
}
【问题讨论】: