Reputation: 6013
I have just set up a wi-fi network at home. I have all my files on my desktop computer (192.168.1.56) and want to access localhost over there from another computer (192.168.1.2).
On my desktop I can access localhost through the normal http://localhost. Apache is running on port 80 as usual.
What do I have to do to achieve this? There is documentation on the net but they either don't work or are too fragmented and confusing to understand.
I think I have to make changes to my apache's httpd.conf file and the hosts file. Any ideas as to what changes to make?
Upvotes: 204
Views: 877667
Reputation: 81
If someone is still finding it hard, this simple thing worked for me:
Hope it helps! Thanks.
Upvotes: 8
Reputation: 1258
The easiest way to access Apache running on localhost from another computer is using https://pinggy.io . Just run the following command:
ssh -p 443 -R0:localhost:80 a.pinggy.io
It will give you a public URL.
Upvotes: 0
Reputation: 1
I noticed that windows 10 home edition does not support hosting website.
windows 10 professional does support hosting website, so it works once add the windows machines ip address to httpd.conf file after listen 80, the ip address for the local hosting windows machine can be found by ipconfig in cmd windows.
Listen 80
Listen 192.168.0.197:80
Upvotes: 0
Reputation: 11
Just try:
http://ipaddressofpcwhichhasdatabase:portnumber(80 by default)/filename.extension
Upvotes: 1
Reputation: 1138
it's very easy
Search for
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
**Require local** Replace with **Require all granted**
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>```
Go to xampp > config > click on service and port setting and change apache port 8080
Upvotes: 71
Reputation: 7943
Host in local IP,
Open CMD : ipconfig
Wireless LAN adapter Wi-Fi: IPv4 Address. . . . . . . . . . . : xx.xxx.xx.xxx
Upvotes: 0
Reputation: 1
To Run Nodejs Server over Network
const port = process.env.PORT || 3000;
const server = http.createServer(
server.listen(port, '0.0.0.0', () => console.log(`Server started on port ${port}`)
));
run http://yournetworkipaddress:3000 to access your application over local area network (LAN)
Steps to find your network ip.
MacOS
Upvotes: -3
Reputation: 29829
Prerequisite: Your website is currently on http://localhost:8081/
with a tool like live-server
Within the same network, you can access your machine with your current ip address or hostname. You can find the ip address running ipconfig | grep IPv4
or the hostname by sending a ping -a
to that ip.
http://192.128.1.18:80/
http://hostname:80/
Note: For best results, use port 80, connect on a private network, and check your firewall settings.
Opt 1 - You can use ngrok to provide port forwarding over ngrok's public facing ports
Download ngrok and run the following command:
$ ./ngrok http 8081
Opt 2 - You can use localhost.run to create a ssh tunnel with the following command:
ssh -R 80:localhost:8081 kylemit@ssh.localhost.run
To connect your browser dev tools with a connected device, follow the instructions at Get Started with Remote Debugging Android Devices
Open Dev Tools > More Tools > Remote Debugging (try here if Device Not Detected)
Find your site and Click Inspect which will open up a new inspector window
Upvotes: 5
Reputation: 1
I was having this issue. I was using XAMPP in a virtual machine which was having network setting as "NAT". I changed it to "Bridged" and the problem got solved.
Upvotes: 0
Reputation: 1
So I was trying to solve a similar problem with connecting to a totally different server on my own LAN so that when power is interrupted and then restored that my server comes back online and other systems can still have connectivity with automation. However, my problem was DHCP giving my server a diff IP on occasion. This thread answered my problem with the NAMESERVER that windows have natively. I was connecting directly to my servers IP add http://192.168.1.5 through a batch file to initialize the connection but when power problems happen it would not connect. I changed the .bat file to point at http://DESKTOP-actualnamewhereserver:port and done. Problem solved. IF I don't change my computers names then when DHCP hands DESKTOP-actualnamewhereserver a new IP address it will still identify as its own name on the LAN and therefore be able to accept the connection regardless of it's IP Address. Simply give the other people on your wireless LAN the name of your pc hosting the Apache server and lets say its name is DESKTOP-DOUGHFACTORYHUT they will type http://DOUGHFACTORYHUT:80 or whatever port number your apache config is set to host at like LOCALHOST:80 which essentially are the same thing attached to your local Dynamic IP address assigned by DHCP or STATIC IP you have set to the server.
Upvotes: -1
Reputation: 1802
Replace
Require Local
with Require all granted
in xampp\apache\conf\extra\httpd-xampp.conf
file.
Upvotes: 0
Reputation: 1540
Go to xampp-control in the Taskbar
xampp-control -> Apache --> Config --> httpd.conf
Notepad will open with the config file
Search for
Listen 80
One line above it, there will be something like this: 12.34.56:80
Change it
12.34.56:80 --> <your_ip_address eg:192.168.1.5>:80
Restart the apache service and check it, Hopefully it should work...
Upvotes: 5
Reputation: 286
First Go To Network and Sharing center of your windows machine.and Just follow some steps to get your IPv4 address.
Put the IPv4 adress on another computer browser. example,http//192.168.0.102
Note
Upvotes: 0
Reputation: 2378
Here is what i did and worked for me on windows 10:
1) Hit windows + r and type cmd . In the command prompt type ipconfig
2) find your ipv4 address and rename your website url to that ip eg: http://192.168.0.2/example.
3) Now make sure your firewall has access to Apache HTTP Server. Search windows for "Allow an app through windows firewall" click on it then on the top right click change settings and make sure the Apache HTTP Server has one tick on the left and one on the private or public. Hope it helps
Now you can access the website from other PCs in the lan
Upvotes: 2
Reputation: 1
<Files ".ht*">
Require all denied
</Files>
replace to
<Files ".ht*">
Require local
</Files>
Upvotes: 0
Reputation: 1
First you go to Command Prompt and type
Notepad C:/windows/system32/drivers/etc/hosts
then add your ip adress below then the url of your site.
Second you go to Command Prompt and type
notepad c:/xampp/bin/apache/apache2.4.18/conf/extra/httpd-vhosts.conf
then add this below
documentroot "Directory of your site"
Allow from all
Require all granted
Upvotes: 0
Reputation: 63
I am Fully agree With BugFinder.
In simple Words, just put ip address 192.168.1.56 in your browser running on 192.168.1.2!
if it does not work then there are following possible reasons for that :
Network Connectivity Issue :
Firewall Problem : Your windows firewall setting do not have allowing rule for XAMPP(apache). (Most probable problem)
Apache Configuration problem. : Your apache is configured to listen only local requests.
Port Conflict with other Servers(IIS etc.)
if all above does not work then probably there is some configuration problem on your apache server.try to find it out otherwise just reinstall it and transfer all php files(htdocs) to new installation of XAMPP/WAMP.
Upvotes: -2
Reputation: 2582
This tool saved me a lot, since I have no Admin permission on my machine and already had nodejs installed. For some reason the configuration on my network does not give me access to other machines just pointing the IP on the browser.
# Using a local.dev vhost
$ browser-sync start --proxy
# Using a local.dev vhost with PORT
$ browser-sync start --proxy local.dev:8001
# Using a localhost address
$ browser-sync start --proxy localhost:8001
# Using a localhost address in a sub-dir
$ browser-sync start --proxy localhost:8080/site1
http://www.browsersync.io/docs/command-line/
Upvotes: 3
Reputation: 7985
After ensuring you've got the appache configs set up as described in the other answers on this page, you may need to also open TCP ports through your firewall as described here:
Upvotes: 2
Reputation: 51
If you are using XAMPP 1.8.3 Navigate to file httpd-xampp.conf and search for " # # New XAMPP security concept # server-status | server-info))">
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
"
Cut this code and save it somewhere for later use i.e restoring this feature( remember removing this code makes your computer vulnerable). Save changes on httpd-xampp.conf, restart services on XAMPP and that's it.
Upvotes: 4
Reputation: 251
These are the steps to follow when you want your PHP application to be installed on 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
Hope this helps! :)
Upvotes: 25
Reputation: 619
This should be all you need for a basic setup
This kind of configuration doesn't break phpMyAdmin on localhost
A static IP is recommended on the device running the server
This example uses the 192.168.1.x IP. Your network configuration might use a different IP
In the httpd.conf in Apache you should have:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
I would leave blank the name so it gets the defaults:
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
Allow the guest machines and yourself. As a security caution, you might avoid Allow from all but instead use specific guest IP for example Allow from 192.168.1.xxx where xxx is the guest machine IP. In this case you might need to consider static IPs on guest machines also
# Controls who can get stuff from this server.
#
# Require all granted
# onlineoffline tag - don't remove
Order Deny,Allow
# Deny from all
Allow from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
Allow from 192.168.1.*YOURguestIP*
Allow from 192.168.1.*YOURselfIP*
</Directory>
Restart all services and Put Online from the tray icon
Upvotes: 5
Reputation: 1195
If you are connected to Wi-Fi network, then it is much simpler. Just find the Ip in which you have connected to the Wi-Fi. Eg:
your-ip is "10.10.55.67".
Then start the xampp server in your machine.
Then in anyother computer connected to the same Wi-Fi n/w, type
http://your-ip
Eg:http://10.10.55.67
Upvotes: 1
Reputation: 71
Sometimes your firewall can be the problem. Make sure you've disabled your antivirus firewall monitoring. It worked for me.
Upvotes: 7
Reputation: 591
Thanks for a detailed explanation.
Just to Elaborate, in Windows, Go to Control Panel -> Firewall, in exceptions "add http and port 80". Then in Services check mark "http (web server port 80)" and "https (web server port 443)" ONLY if you need https to work also. Ok, OK, Close
Then go to any computer on network and type http://computer-name (where you change the firewall and has the xampp running on it) in your web browser and happy days :)
Upvotes: 59
Reputation: 17858
Localhost is just a name given for the loopback, eg its like referring to yourself as "me" ..
To view it from other computers, chances are you need only do http://192.168.1.56 or http://myPcsName if that doesnt work, there is a chance that there is a firewall running on your computer, or the httpd.conf is only listening on 127.0.0.1
Upvotes: 138