Ljubisa Livac
Ljubisa Livac

Reputation: 832

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.

Upvotes: 0

Views: 133

Answers (1)

unhappyCrackers1
unhappyCrackers1

Reputation: 813

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>

Upvotes: 1

Related Questions