views:

37

answers:

3

I have a server running Ubuntu Lucid 10.04.1 LTS server edition, which I want to deploy a Django app on using Apache + mod_wsgi. At the moment Apache does a directory index instead of using my WSGIScriptAlias command.

Any tips why would be appreciated. I installed mod_wsgi via aptitude and assume the "module configuration" below loads it.

/etc/apache2/apache2.conf

#....

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

#....

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

in sites-enabled there are two files, 000-default-backup and mine.

000-default-backup

<VirtualHost *:80>
    DocumentRoot /var/www/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

mine

<VirtualHost *:80>
    WSGIDaemonProcess project-production user=me group=me threads=10 python-path=/home/me/virtualenvs/project/lib/python2.6/site-packages

    WSGIScriptAlias /project /home/me/projects/project/releases/current/feedback/apache/feedback.wsgi
 <Directory /home/me/projects/project/releases/current/project/apache>
   WSGIProcessGroup project-production
   Order deny,allow
   Allow from all
</Directory>
</VirtualHost>

Looking at the error log, there is no error. So I presume something in the 000-default-backup or apach2.conf is saying "serve this up as a directory" and the WSGI commands are never getting a chance to run. The paths are all correct.

Apache has Server version: Apache/2.2.14 (Ubuntu).

ETA: I want my site to run on a subdirectory, i.e. foo.com/project. (I can't easily create a new subdomain.) So essentially I want the VirtualHost instructions for *:80 to be split over multiple files. Is that possible?

A: 

You don't have ServerName in either VirtualHost and so Apache will not know how to distinguish them and will just use the first VirtualHost in order. Go check the Apache documentation on required directives to be used to setup a VirtualHost properly.

Graham Dumpleton
I modified my question to be clearer. I want my site to run on a subdirectory URL, not its own (sub)domain. Is that possible while maintaining a separate file?
pfctdayelise
A: 

If you installed via aptitude, you might also want to check if you have the latest version of mod_wsgi.

Dave Everitt
A: 

OK I got it working.

/etc/apache2/apache2.conf

change

Include /etc/apache2/sites-enabled/

to

Include /etc/apache2/sites-enabled/000-default-backup

000-default-backup

at the bottom before the "</VirtualHost>" line

add

Include sites-enabled/*.conf

myfile

just remove the "<VirtualHost>" and "</VirtualHost>" lines.

pfctdayelise
Bad way of going about it. Just put the changes direct in 000-default-backup would be easier rather than using a separate file. What you have done will just muck things up for later if you do want multiple virtual hosts.
Graham Dumpleton
I want it to be in a separate file so I can easily enable or disable it, and easily deploy other sites. You are right that it would be a pain if I ever have multiple virtual hosts, but I don't think that will be the case.
pfctdayelise