多个子域冲突问题:Ubuntu Django nginx+apache mod_wsgi

2024-09-29 19:31:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经在我的子域中安装了django应用程序。。子域1。我的域名在Ubuntu上使用nginx+apache mod_wsgi。
在我在subdomain2上安装了另一个django应用程序之前,它运行得很好。我的域名。现在子域1。我的域名开始指向安装在子域2中的应用程序。我的域名

这是我的nginx和apache conf…
子域1的nginx配置。我的域名:

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;
    }  
}  

子域2的nginx配置。我的域名:

^{pr2}$

apache conf for subdomain1。我的域名

<VirtualHost *:8080>  

 ServerAdmin admin@mydomain.com
 ServerName  subdomain1.mydomain.com
 ServerAlias www.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。我的域名

<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>

谁能告诉我哪里出错了吗?
提前谢谢!在


Tags: 子域comappdataapacheconfwwwnginx
1条回答
网友
1楼 · 发布于 2024-09-29 19:31:45

正如我所见,两个django应用程序的工作原理是一样的地址:港口在

默认情况下nginx不转发“Host:”头。在

您必须在nginx config中添加以下行:

proxy_set_header Host $host;

相关问题 更多 >

    热门问题