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 –  Apr 04 '11 at 00:41

4 Answers4

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.

MattBianco
  • 587
  • 1
  • 6
  • 23
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.

Charlie
  • 101
  • 2
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?

Jason
  • 193
  • 5
  • When I tried to do do http://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 http://ipaddress:port and it does not work either. –  Apr 04 '11 at 00: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 04 '11 at 01: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.

Cool Charac
  • 101
  • 2