-
10 June 2010, 23:05
Virtual Hosts with Apache
I have been using my server for other things than this site for a while. I work full-time for Rochester Institute of Technology right now on a couple of National Science Foundation grants that are heavy into programming. One project uses the traditional client-server architecture. My work had been all-client recently, so I was using a friend's server deployment. Things changed and I found some bugs in the PHP and MySQL stored procedures. However, running a server locally on my old development machine would kill it. To solve this problem, I decided to use the server running this site. But I'm running a Django site with WSGI, how did I get the two to run side-by-side? Well, I added a subdomain and a virtual host.
The Django docs tell you to add the following lines to
httpd.confif you are using WSGI:Alias /media/ /usr/local/django/fast_forward/media/Order deny,allow Allow from all # Fast Forward engine WSGIScriptAlias / /usr/local/django/fast_forward/apache/django.wsgi Order deny,allow Allow from all Quite simply, this won't work. Go to the same directory that has
httpd.conf; this should be/etc/apache2. Editsites-available/defaultto include what you removed fromhttpd.conf. Also, remove anything that isn't related to logging. Feel free to change that however you'd like.Next I had to make a new file:
sites-available/newsub.gada.ms. In this file, do whatever you need to do to execute your new site as you would inhttpd.conf. Here's part of mine (almost), minus the stuff to run the PHP with CGI and access control.ServerName newsub.gada.ms ServerAlias www.newsub.gada.ms ServerAdmin webmaster@domain.tld DocumentRoot /path/to/nsfproject/public_html/ ... The request is forwarded to the virtual host whose ServerName matches the host name specified in this field.