Forward Apache to Django dev server

apache-2.2djangovmware-player

EDIT:

I just went with Nginx to do the proxy in front of Apache. Much easier to set up and it actually worked.


I'm trying to get apache to forward all requests on port 80 to 127.0.0.1:8000, which is where the django dev server runs. I think I have it forwarding properly, but there must be an issue with 127.0.0.1:8000 not being run by apache?

I'm running the django dev server in an ubuntu vmware instance, and I'd other people in the office to see the apps in development without having to promote anything to our actual dev/staging servers.

Right now the virtual machine picks up an IP for itself, and when I point a browser to that url with the defualt apache config, I get the default apache page.

I've since changed the httpd.conf file to the following to try and get it to forward the requests to the django dev server:

ServerName localhost

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

<VirtualHost *>
    ServerName  localhost
    ServerAdmin alex@example.com

    ProxyRequests off
    ProxyPass * http://127.0.0.1:8000
</VirtualHost>

All I get are 404s with this, and in error.log I get the following (192.168.1.101 is the IP of my computer 192.168.1.142 is the IP of the virtual machine):

[Mon Mar 08 08:42:30 2010] [error] [client 192.168.1.101] File does not exist: /htdocs

Best Answer

Is that better?

<VirtualHost *>
    ServerName  localhost
    ServerAdmin alex@example.com

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass *  http://127.0.0.1:8000
ProxyPassReverse *  http://127.0.0.1:8000
</VirtualHost>

Did you restart apache? Is the error message still about the directory??

Related Topic