1

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.

1
  • Which parts of the configuration have you changed so far? Sep 4, 2012 at 3:42

2 Answers 2

1

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.

0

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 [email protected]
    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>
1
  • 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, 2012 at 1:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .