With the time change today it officially feels like summer time. Well, that and the fact that this weeked was the first beautiful weekend of the year, sunny and 75. Doesn’t get much better than that. I was lucky enough to hang out with some old friends from my pizza-slinging days Friday and go on a hike to raven cliffs Saturday.
I have been having an issue trying to get my symfony-created projects to work on godaddy’s shared hosting plan and until I can get that working, I have to make the projects accessible from my home server. The details of my server journey are well-documented and I decided to take my old dell computer and throw ubuntu 8.10 on there and serve them that way. I popped in my ubuntu disc and started the install process. Installed no problem, eezy breezy. After installation I wanted to set up a static IP address on the local network to make it simpler for me to port forward any requests to the server from the net. There’s a known bug with Intrepid Ibex and static IPs and after a little searching I found a guide to fix the bug. Apparently I can’t follow directions because I ended up with no Network Manager and no internet. I tried reinstalling the Network Manager but I couldn’t get it to recognize my working ethernet card ( the integrated NIC on the mobo died a couple years ago).
So I was getting ready to reinstall Intrepid Ibex until I realized it is prolly better to just use 8.04 LTS Server since I’ve launched a symfony project on it already for work. Popped that bad boy in and got the server up and running ~30 minutes later.
Now comes the issue with setting up multiple sites on a single server, on a single IP address, with no domain name. I’ve searched high and low for a simple way to do redirects with folders and things in the url but it was all just frustrating me. I decided that the simplest way to set up the multiple projects under my single (comcast) IP was to use port virtual host routing. I tried this the other day on my Win XP box, but just could not get it to work.
I pulled up Apache’s virtual hosting examples page and started from scratch. I knew that the port forwarding was working correctly on my router. I also knew that the pages themselves were working properly when accessing them locally. I just kept adding each little piece to the puzzle without putting any extra information in there that might break it. I finally got it working and it’s beautiful! I found the biggest issue was using the correct IP address for the ‘NameVirtualHost’ field. I had been using the public IP address and not the local network IP address. I also added a ServerName to each record so that Apache won’t complain when I start it up. Apache will still run fine when you start it up without ServerNames but you get warning messages and I’m too anal to let that keep popping up warnings. Here’s the, rather simple, code to get it to work:
Listen 80
Listen 8080
NameVirtualHost 192.168.1.50:80
NameVirtualHost 192.168.1.50:8080
<VirtualHost 192.168.1.50:80>
ServerName research
DocumentRoot /var/www/research/web
DirectoryIndex index.php
</VirtualHost>
<VirtualHost 192.168.1.50:8080>
ServerName cnp
DocumentRoot /var/www/cnp/web
DirectoryIndex index.php
</VirtualHost>
So one problem down, two million to go!
Till Next Time