开发者

Problem with multiple subdomains conflict : Ubuntu django nginx+apache mod_wsgi

I have installed my django application on one of my subdomains .. subdomain1.mydomain.com using nginx+apache mod_wsgi on Ubuntu.

It was working fine until I installed another django application on subdomain2.mydomain.com.Now subdomain1.mydomain.com started pointing to application installed on subdomain2.mydomain.com

Here is my nginx and apache conf..

nginx configuration for subdomain1.mydomain.com:

upstream  subdomain1_backend  {
    server  127.0.0.1:8080;
}  
server {  
    listen       80;  
    server_name  subdomain1.mydomain.com www.subdomain1.mydomain.com;  
    location / {
        proxy_pass http://subdomain1_backend;
    }  
}  

nginx configuration for subdomain2.mydomain.com:

upstream  subdomain2_backend  {
    server  127.0.0.1:8080;
}  
server {  
    listen       80;  
    server_name  subdomain2.mydomain.com www.subdomain2.mydomain.com;  
    location / {
        proxy_pass http://subdomain2_backend;
    }  
}

apache conf for subdomain1.mydomain.com

<VirtualHost *:8080>  

 ServerAdmin admin@mydomain.com
 ServerName  subdomain1.mydomain.com
 ServerAlias ww开发者_运维百科w.suddomain1.mydomain.com

 DocumentRoot "/srv/webapps/subdomain1.mydomain.com"

 WSGIScriptAlias / /srv/webapps/subdomain1.mydomain.com/conf/app.wsgi  
 WSGIDaemonProcess www.subdomain1.mydomain.com user=www-data group=www-data threads=15 processes=2 maximum-requests=10000    
 WSGIProcessGroup www.subdomain1.mydomain.com  
 <Directory /srv/webapps/subdomain1.mydomain.com/app/>  
   Order deny,allow  
   Allow from all  
 </Directory>  
 ...   
 </VirtualHost></code>

apache conf for subdomain2.mydomain.com

<VirtualHost *:8080>  

 ServerAdmin admin@mydomain.com
 ServerName  subdomain2.mydomain.com
 ServerAlias www.suddomain2.mydomain.com

 DocumentRoot "/srv/webapps/subdomain2.mydomain.com"  
 WSGIScriptAlias / /srv/webapps/subdomain2.mydomain.com/conf/app.wsgi  
 WSGIDaemonProcess www.subdomain2.mydomain1.com user=www-data group=www-data threads=15   processes=2 maximum-requests=10000    
 WSGIProcessGroup www.subdomain2.mydomain.com  
 <Directory /srv/webapps/subdomain2.mydomain.com/app/>  
   Order deny,allow  
   Allow from all  
 </Directory>  
 ...   
 </VirtualHost>

Can anyone tell where I'm going wrong?

Thanks in advance!


As i can see, your both django applications works on the same address:port

By default nginx is not forwarding "Host:" header.

You must add this line to you nginx config:

proxy_set_header Host $host;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜