Set Up IP-Based Virtual Hosts In Apache

If your server has multiple IPs  and you want to host different website for each IP you can use Apache’s IP-based virtual hosts feature.

Setting up IP-based virtual hosts is easy. First, open up httpd.conf found in the conf directory of your Apache installation directory.

You need to register the IPs that you want Apache to listen on. After the line that says “Listen 80” add:

Listen 10.0.0.1:80
Listen 10.0.0.2:80

If you wish to host websites on ports other than port 80, let’s say 8080, you also need to register it as a port that Apache listens on.

Listen 8080

You can also listen to specific address and port combinations:

Listen 10.0.0.1:8081
Listen 10.0.0.2:8082

Normally, Apache will respond to requests with the default site as defined in httpd.conf. However, you can define different sites for every address and port combination defined in your listen directive. Just add the following for every combination:

<VirtualHost ip-address:port-number>
   ServerAdmin [email protected]
   DocumentRoot /www/docs/www.example.com
   ServerName www.example.com
   ErrorLog logs/www.example.com-error_log
   CustomLog logs/www.example.com-access_log common
</VirtualHost>

<VirtualHost *:80> means this virtual host will handle HTTP requests for any IP on port 80. This virtual host corresponds to “Listen 80”.

<VirtualHost 10.0.0.1:80> means this virtual host will handle HTTP requests for 10.0.0.1  on port 80. This virtual host corresponds to “Listen 10.0.0.1:80”.

<VirtualHost 10.0.0.2:80> means this virtual host will handle HTTP requests for 10.0.0.2  on port 80. This virtual host corresponds to “Listen 10.0.0.2:80”.

<VirtualHost 10.0.0.1:8081> means that this virtual host will handle HTTP requests for the IP address 10.0.0.1 on port 8081. This virtual host corresponds to “Listen 10.0.0.1:8081”.

<VirtualHost 10.0.0.2:8082> means that this virtual host will handle HTTP requests for the IP address 10.0.0.2 on port 8082. This virtual host corresponds to  “Listen 10.0.0.2:8082”.

Save and restart Apache.

That’s it!

Typhoon Peping

Typhoon Peping (aka Parma) shifted course and mercifully spared the flood-inundated areas from further punishment. It was such a relief since I can just imagine how more rains will swell the already flooded streets and rivers (or are they one and the same?).

RIP David Fernando

I heard from Roly that our boss at a previous company died last Saturday during the height of Typhoon Ondoy. A wall at their home, weakened by floodwater, collapsed on him.

DTF or Sir Dave as he was fondly called, was a certified techie. He was one of my mentors. Mine and of many others. He will be missed.

Typhoon Ondoy

Typhoon Ondoy (aka Ketsana) struck and Metro Manila hit really hard.  I was supposed to have a business meeting with Tina at High Street but she texted me that the weather is not cooperating and that we should postpone. The driving rain was quite persuasive so I agreed.

But I didn’t realize it was so bad until late afternoon when James texted about impassable streets and houses flooded up to their second levels! We went out today and devastation was quite evident along our way. But we didn’t see the worst of it till we saw the news. Debris, submerged houses, vehicles stacked like dominos,hundreds if not thousands of refugees. One of the hardest hit areas was Pasig. To think we were not-too-long-ago considering moving there. Horrible.

If  you want to know how to help the victims, check this Google docs spreadsheet.

Sun Broadband Wireless

Michelle and I finally decided to subscribe to Sun Wireless Broadband. We were quite reluctant at first because of all the horror stories about wireless Internet access. Not just about Sun but also Globe and Smart. In fact, I think Smart Bro started it all, the horror stories.

But recently, there have been better feedback about Sun’s product to the point that people are even saying that Globe and Smart is a waste of time and money. That’s a big turnabout since Sun is really notorious for their poor signal and poor interconnection (but I’m sure it’s not entirely their fault there). And although the horror stories are not completely gone, we decided to take a leap of faith and get one.

Of course, we chose the no commitment option: Buying the modem for less expensive promo price of P1,595 (instead of the overpriced P1,895) and getting the unlimited account for P799 a month. The transaction was reasonably fast and painless. I guess they were eager to make a sale. We filled up two forms (one for the account and one for the credit card billing) and then were given a Huawei E1550 HSDB USB modem. After a short tutorial where the only thing I really heard was about some 24 hour activation, we’re off.

So after getting home,plugging in the USB modem, installing the built-in software, and waiting the requisite 24 hours, here we are surfing wirelessly.  And the speed was a miserably slow 150Kbps or so. There are times when it struggles, and there are times (early in the morning) when it’s pretty fast but it’s usually just around 150Kbps. So I guess some of the horror stories are true.

But still it’s not too bad for unlimited wireless for P799 a month. Of course, I definitely want Sun to fix and improve it. Who doesn’t, right? I hope Globe and Smart wake up from their stupor on their self-imagined laurels and goad Sun to fix and improve. And they should all have service level commitments. But for now, Sun is it.