Reputation: 87
I have made a local host with one pc and I am trying to access it through other devices. The problem is the server is accessable only in the host. What should I do to make connection possible through other devices in the network. I use Xampp for local host and IP address of the host to make connection through browser.
Upvotes: 4
Views: 15129
Reputation: 431
For anyone who use Ubuntu, etc, in my case, it's happen since I use UFW and never open the port 80. You can check it by this command:
sudo ufw status verbose
To make port 80 accessible:
sudo ufw allow 80
Then turn it off again when unneeded:
sudo ufw disallow 80
Sorry to say it here
Upvotes: 1
Reputation: 555
localhost itself means that the host is located on the local computer so it cannot be accessed directly from an external computer. when you type localhost on the browser your server recognizes it and redirects it to a local port or ip address according to the address that is given. localhost is a special hostname that almost always resolves to 127.0.0.1. If you ask someone else to connect to http://localhost they'll be connecting to their computer instead or yours.
so in order to reach this computer you need to find what your local network's IP of that computer is. Then other people can access to your site by that IP.
If devices are in the same network:
You can find your local network's IP by go to Command Prompt or press Windows + R then type in ipconfig or ipconfig /all. It will give out some information and your local IP should look like 192.168.1.x.
You'll also need to make sure any firewalls you may have configured allow traffic on port 80 to connect to the XAMP server
These are the steps to follow when you want your PHP application to be accessed from a LAN server (not on web)
Note: If firewall is installed, ensure that you add the http port 80 and 8080 to exceptions and allow to listen.
Go to Control Panel>Windows Firewall>Allow a program to communicate through windows firewall>Add another program Name: http Port: 80
Add one more as http - 8080
If IIS (Microsoft .Net Application Internet Information Server) is installed with any Microsoft .Net application already on server, then it would have already occupied 80 port. In that case change the #Listen 192.168.1.193:80
to #Listen 192.168.1.193:8080
If devices are in different network: you can use following external services to access your computer in n easy way
Upvotes: 6