Hi, I have a django project up and running on Webfaction, but would now like to have it support multiple virtual hosts. All instances will use the same django project, just a different settings file and separate DB. I've been reading about setting up VirtualHosts in Apache, but I'm a little lost because the default httpd.conf doesn't already have a virtual host entry so I'm not sure what should go in that section versus what remains outside of it. Also, it seems there are different ways to set it up to be more efficient. Is there any documentation on how to go from a default httpd.conf to one with Virtual Host Entries? Thanks asked 29 Feb '12, 16:51 roam3greg |
The VirtualHost entries should look like this:
answered 29 Feb '12, 18:06 seanf OK, that was one of the references I was using, but wasn't sure how to implement it. My httpd.conf (in part) went from this:
To this:
But I get a 404 error now. I've mucked about, but I don't know enough to know what's wrong.
(29 Feb '12, 19:10)
roam3greg
I just fixed the formatting on your comment (you need to indent code blocks). The NameVirtualHost and VirtualHost bits needs to include asterisks as I showed in my example, "*: 23113" and not "username.webfactional.com:23113". Can you fix that, restart your Apache, and try again? Also, this is a public forum, so you might want to leave sensitive details like your username and hostname out of your comments :)
(29 Feb '12, 19:17)
seanf
Replacing the url with * generates a 500 Internal Server Error message. I had tried that originally. I also figured that couldn't be the answer as how would I setup multiple domains? A * on NameVirtualHost and url in VirtualHost block gives me a warning when restarting Apache, and a 404. So I think the error is in the VirtualHost block.
(29 Feb '12, 20:38)
roam3greg
|
The answer is that the setup I had was mostly correct. It does need *:port everywhere, but the problem was that the first value in WSGIDaemonProcess and the WSGIProcessGroup have to have the same value. However, if there are multiple <virtualhost> blocks the same Process name can't be used in each block. answered 01 Mar '12, 12:49 roam3greg That's the reason that the example I provided used "YOUR_DOMAIN.com" in the WSGIProcessGroup and WSGIDaemonProcess directives - to ensure that it would match within each virtual host, and that it would be unique to each virtual host.
(01 Mar '12, 13:00)
seanf
|