How to access my localhost from another PC in LAN?

前端 未结 4 1648
情歌与酒
情歌与酒 2020-12-06 01:10

I am using WAMP server to run my website. I am using Windows 7.

I created LAN between 2 PC and I want to access my localhost from the second PC.
Note that I am n

相关标签:
4条回答
  • 2020-12-06 01:33

    after your pc connects to other pc use these 4 step:
    4 steps:
    1- Edit this file: httpd.conf
    for that click on wamp server and select Apache and select httpd.conf
    2- Find this text: Deny from all
    in the below tag:

      <Directory "c:/wamp/www"><!-- maybe other url-->
    
        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs/2.4/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks
    
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   AllowOverride FileInfo AuthConfig Limit
        #
        AllowOverride All
    
        #
        # Controls who can get stuff from this server.
        #
    #    Require all granted
    #   onlineoffline tag - don't remove
         Order Deny,Allow
        Deny from all
         Allow from 127.0.0.1
         Allow from ::1
         Allow from localhost
    </Directory>
    

    3- Change to: Deny from none
    like this:

    <Directory "c:/wamp/www">
    
        #
        # Possible values for the Options directive are "None", "All",
        # or any combination of:
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
        #
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
        # doesn't give it to you.
        #
        # The Options directive is both complicated and important.  Please see
        # http://httpd.apache.org/docs/2.4/mod/core.html#options
        # for more information.
        #
        Options Indexes FollowSymLinks
    
        #
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   AllowOverride FileInfo AuthConfig Limit
        #
        AllowOverride All
    
        #
        # Controls who can get stuff from this server.
        #
    #    Require all granted
    #   onlineoffline tag - don't remove
         Order Deny,Allow
        Deny from none
         Allow from 127.0.0.1
         Allow from ::1
         Allow from localhost
    

    4- Restart Apache
    Don't forget restart Apache or all servises!!!

    0 讨论(0)
  • 2020-12-06 01:41

    Actualy you don't need an internet connection to use ip address. Each computer in LAN has an internal IP address you can discover by runing

    ipconfig /all
    

    in cmd.

    You can use the ip address of the server (probabily something like 192.168.0.x or 10.0.0.x) to access the website remotely.

    If you found the ip and still cannot access the website, it means WAMP is not configured to respond to that name ( what did you call me? 192.168.0.3? That's not my name. I'm Localhost ) and you have to modify ....../apache/config/httpd.conf

    Listen *:80
    
    0 讨论(0)
  • 2020-12-06 01:58

    IP can be any LAN or WAN IP address. But you'll want to set your firewall connection allow it.

    Device connection with webserver pc can be by LAN or WAN (i.e by wifi, connectify, adhoc, cable, mypublic wifi etc)

    You should follow these steps:

    1. Go to the control panel
    2. Inbound rules > new rules
    3. Click port > next > specific local port > enter 8080 > next > allow the connection>
    4. Next > tick all (domain, private, public) > specify any name
    5. Now you can access your localhost by any device (laptop, mobile, desktop, etc).
    6. Enter ip address in browser url as 123.23.xx.xx:8080 to access localhost by any device.

    This IP will be of that device which has the web server.

    0 讨论(0)
  • 2020-12-06 01:59

    You have to edit httpd.conf and find this line: Listen 127.0.0.1:80

    Then write down your desired IP you set for LAN. Don't use automatic IP.
    e.g.: Listen 192.168.137.1:80

    I used 192.167.137.1 as my LAN IP of Windows 7. Restart Apache and enjoy sharing.

    0 讨论(0)
提交回复
热议问题