2

So I installed Apache web server/MySQL/myPhpAdmin on my windows machine. It's on my desktop. Everything works where if I go to http://localhost, localhost/phpinfo.php and localhost/phpmyadmin.index.php they all show up on my machine.

Now I want other users to be able to access my website, which is http://localhost/page1.php I already did port forwarding on the machine where the server is hosted and forwarded port 80 on the ip address of the local machine since I have a router.

But people can't access this website from elsewhere or even on other computers within my home network. Do I have to actually get a domain from a site like godaddy or google? Or can I just have people connect to my local machine (which has the apache web server), and host my own website on it.

I am really confused on how to actually proceed after I installed my web server and created a page in my apache root directory. Can anyone guide me on how to set this up since I don't have any real experience in this area.

Thanks!

  • 1
    Even if u opened up the port on your machine, the address won't be localhost it will most likely be your machine external ip, internal if you are trying to access from your local network – Daniel Apr 4 '11 at 0:41
1

Check the Listen directive in your config file for apache httpd.

Also verify what addresses the server is LISTENing on. netstat -na is useful for that. It needs to listen on 0.0.0.0 (or *) or the address of your machine. Not 127.0.0.1.

0

So the problem you are likely having is that "localhost" should always be the local machine. (If not there's problems). So on your machine, it's your machine. On my machine it's my machine.

Assuming you have the port forwarding setup correctly, and your ISP permits traffic routing to port 80, other people should be able to hit your router's public IP address on port 80 (and get to your server's port 80).

You'll also want to verify your Apache setup. If named virtual hosting is setup, could mean that when you access the server locally through http://localhost/ you'll see one set of hosted content, but when someone else accesses the server through http://the-ip-address/ they could get other hosted content.

0

You should start by figuring out why other machines in the same network can't see your server. What happens when they try? Have you tried using both the machine name and IP address in the remote machine's browser? Do they give the same result?

  • When I tried to do do localhost on my laptop in the same network, the page just does not load i.e page does not exist. What do you mean by using both machine name and ip address? I tried to do the ipaddress:port and it does not work either. – Eric Apr 4 '11 at 0:59
  • 1
    localhost is always the machine you're on. You cannot use localhost to refer to a remote machine. Can you ping machine a (the server with your php page) from machine b? – Jason Apr 4 '11 at 1:22
0

In my case I needed to allow the http and https ports in my firewall. On Ubuntu the firewall is called ufw and on CentOS/Red Hat it's called firewall-cmd. To make the changes take effect you will also need to reload the firewall configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy