2
votes

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?

3

3 Answers

1
votes

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.

0
votes

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.

-1
votes

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