Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VPS (Ubuntu 10.04) that hosts multiple domains, one of them being a CodeIgniter (PHP) web app. The others are just static websites, no fancy backend languages required.

Well I am starting a new project and want to use Django. I have Django installed, mod_wsgi enabled in Apache2, but when I did the first steps on the documentation, it seemingly overwrote my existing Apache2 configuration and served up the Django welcome page to all my domains. What should my httpd.conf file should look like so that it doesn't overtake all my domains.

share|improve this question
    
Which parts of the configuration have you changed so far? –  Shane Madden Sep 4 '12 at 3:42

2 Answers 2

up vote 0 down vote accepted

If you don't want it mounted at the root of the web site, then you can mount it at a sub URL.

WSGIScriptAlias /suburl /path/to/mysite.com/mysite/wsgi.py

Alternatively, if want it notionally mounted at root of web site, but for PHP URLs to take precedence, use the AddHandler/mod_rewrite method of configuration explained in:

http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive

That or use distinct VirtualHost and ServerName as suggested in other answer.

share|improve this answer

but when I did the first steps on the documentation, it seemingly overwrote my existing Apache2 configuration and served up the Django welcome page to all my domains.

Add it into a separate virtual host, don't append to your main configuration file (httpd.conf):

<VirtualHost *:80>
    ServerAdmin youremail@domain.com
    DocumentRoot /path/to/mysite.com/mysite
    ServerName django.domain.com

    WSGIScriptAlias / /path/to/mysite.com/mysite/wsgi.py
    WSGIPythonPath /path/to/mysite.com

    <Directory /path/to/mysite.com/mysite>
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>
    </Directory>
</VirtualHost>
share|improve this answer
    
Okay that worked with some small modifications. It looks like this now WSGIPythonPath /srv/www/django <VirtualHost *:80> DocumentRoot /srv/www/django ServerAlias django.****.com WSGIScriptAlias / /var/www/apache/django.wsgi <Directory /srv/www/django> <Files django.wsgi> Order deny,allow Allow from all </Files> </Directory> </VirtualHost> but yet at django.****.com, it still serves up just ***.com even with all of the proper records set. Any ideas? –  Bert B. Sep 5 '12 at 1:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.