简体   繁体   中英

VirtualHost for django site on dedicated server with multiple web sites

So, i'm trying to run Django web site on my dedicated server which has multiple sites on itself and its folder structure looks like this:

home/user/www/
              site1/
              site2/
              site3/
              mydjangosite.com/

site1, site2 etc. are php/html web sites, and of course i need to keep them runing, so i'm wondering how should i configure my httpd.conf because these lines below are not working:

<VirtualHost *:80>
    DocumentRoot home/user/www/mydjangosite.com
    ServerName mydjangosite
    WSGIScriptAlias / home/user/www/mydjangosite.com/testing/wsgi.py
    <Directory "home/user/www/mydjangosite.com/testing">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

EDIT

I've modified my httpd.conf and instead of lines above (with VirtualHost *:80) i've added next:

WSGIScriptAlias / /home/user/www/mydjangosite.com/testing/wsgi.py
WSGIPythonPath /home/user/www/mydjangosite.com
<Directory /home/user/www/mydjangosite.com/testing>
    <Files wsgi.py>
    Order deny,allow
    Allow from all
    </Files>
</Directory>

and finally i've got Django succes page:

It worked!
Congratulations on your first Django-powered page.

But now i get that Django page for every domain that is on my server.

Try this:

<VirtualHost *:80>
    DocumentRoot /home/user/www/mydjangosite.com
    ServerName mydjangosite
    WSGIScriptAlias / /home/user/www/mydjangosite.com/testing/wsgi.py
    <Directory "/home/user/www/mydjangosite.com/testing">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Instead of:

<VirtualHost *:80>
    DocumentRoot home/user/www/mydjangosite.com
    ServerName mydjangosite
    WSGIScriptAlias / home/user/www/mydjangosite.com/testing/wsgi.py
    <Directory "home/user/www/mydjangosite.com/testing">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM