Accessing localhost (xampp) from another computer over LAN network - how to?

后端 未结 24 3124
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 14:01

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.

相关标签:
24条回答
  • Just try:

    http://ipaddressofpcwhichhasdatabase:portnumber(80 by default)/filename.extension
    
    0 讨论(0)
  • 2020-11-22 14:39

    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.

    0 讨论(0)
  • 2020-11-22 14:40

    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

    0 讨论(0)
  • 2020-11-22 14:42

    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

    0 讨论(0)
  • 2020-11-22 14:42
    <Files ".ht*">
     Require all denied
    </Files>
    
     replace to
    
    <Files ".ht*">
     Require local
    </Files>
    
    0 讨论(0)
  • 2020-11-22 14:42

    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

    1. Go to System Preferences > Network
    2. Check network IP address under the connected.
    0 讨论(0)
提交回复
热议问题