Steven Evans's picture

I've set up a LAMP server that is designed to host two websites.   This LAMP server is one of two computers that is connected to a router in my home.  The other computer (which is also connected to the router) is a machine that is running Windows XP.

Each of the two websites, that I'm trying to host, are using virtual IP addresses that I set up on the server.  However, I have since learned that these two websites can only be viewed using the Windows XP computer that's connected to the router.  If I try to view the websites outside of my home with a completely different computer, the websites simply don't load.  I want to know why, and I want to know how to solve this problem.

The two websites are being hosted with virtual IP addresses.  I suspect that the problem may have something to do with the IP addresses that I'm using, but I'm not sure.  Let me explain how I chose the two IP addresses that are used for each of the websites.

I first typed "ifconfig" at the Linux prompt on the server computer in order to get the IP address for the server computer.  Once I had this IP address, I pinged two IP addresses that are similiar to it.  For instance, if the server IP address was 123.45.67.8, I pinged 123.45.67.9 and 123.45.67.10 in order to make sure that they weren't already in use.  Once I saw that they were not in use, I decided to use them as static IP addresses for my two websites.  So I set up all three IP addresses (including the one for the server) as static IP addresses by declaring them as such in corresponding "ifcfg-ethX" files, where "X" denotes the ethernet connections.  So I have three of these files.  One is for the server IP address, and the other two are for the virtual IP addresses for the websites.  So the files are named as the following: ifcfg-eth0, ifcfg-eth0:1 and ifcfg-eth0:2.  Each of the files are set up as static IP addresses that I got by means of the way that I described earlier.

After setting up the websites, I'm able to view them with a browser on my WindowsXP computer.  If I type the IP addresses in the browser, the websites come up with no problem.  However, this doesn't work on computers that are outside of my home.

I hope that someone is able, and willing, to tell me what I'm doing wrong so that these websites may become accessible to everyone in the outside world.  What am I doing wrong?

Thanks for your time.

Forum: 
Alex Bassett's picture

Hi.

 Have you configured your router  to forward these virtual ip addresses to the internet ?

ipaddress + port +tcp and or udp or both  eg:123.456.7.9:80 tcp/udp

This is the usually the way I start my connection tests because sometimes the easy things are missed .

good luck


Jeremy Davis's picture

I thought that I replied to this last night but obviously not...

It sounds like you may be unaware that LAN IPs and WAN IPs are different. Like Alex suggests you will need to forward your WAN IP to your LAN IP. And if you want to host multiple sites from a single WAN IP then you will either need to use different ports or a reverse proxy.

Steven Evans's picture

Thanks to both of you.  You're both right.  I was using internal IP addresses.  I didn't realize there was a difference until reading your posts.

Because my ISP (AT&T) will charge me extra for static IP addresses, I've decided to drop the whole idea of doing my own hosting.  It's cheaper, and easier, to just find a cheaper web host.

Thanks to both of you for your help.  Your posts got me on the right track to finding a solution.  I appreciate it.


Jeremy Davis's picture

You can still host with dynamic IP. You will just have to decide how you will configure your 2 sites.

Either you can point both FQDNs to point to your (dynamic) IP (using a service like TKLs HubDNS or ChangeIP.org) and use name based virtual hosts. Or if you wish to have them served by 2 different LAMP appliances then either have a reverse proxy to redirect to the relevant server/sites. Or use alternative ports and use a dynamic DNS host like ChangeIP (they support FQDN redirection to specific ports).

Add new comment