Accessing website files and phpmyadmin in wamp from another computer on lan

我只是一个虾纸丫 提交于 2019-11-30 16:43:07

By default WAMPServer is configured to be a standalone development system for running on your workstation.

If you want to run Wamp on one PC and access it from another you have to change the Apache security configuration.

You dont mention anything useful like the version of WampServer you are running so I guess I will have to document both options

Edit httpd.conf ( using the wampmanager menus )

If Apache 2.2.x

Locate this section, I have remove all the comments for the sake of brevity.

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all

#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1     
</Directory>

Change to :

<Directory "c:/wamp/www/">

    Options Indexes FollowSymLinks
    AllowOverride all

#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ::1 localhost

    ## Add an ip range that matches your routers first 3 quartiles
    ## So if your router subnet is 192.168.0 ( use ipconfig to find out what your router is set to )
    ## This will allow any PC on your internal network to access the www folder and subfolders
    Allow from 192.168.0

    ## Or you can specify a specific ip or set of ip's like this
    ## Allow from 192.168.0.10 192.168.0.11 192.168.0.12 ....
</Directory>

If Apache 2.4.x Find this section

<Directory "c:/wamp/www">
    Options Indexes FollowSymLinks
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #
# onlineoffline tag - do not remove
    Require local
</Directory>

Change to :

<Directory "c:/wamp/www">
    Options Indexes FollowSymLinks
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #
# onlineoffline tag - do not remove
    Require local
    Require ip 192.168.0
    ## Apply the same logic as above for specific ip's or a set of ip's
    ## i.e. Require ip 192.168.0.10 192.168.0.11 .....
</Directory>

Now to gain access to phpMyAdmin you have to edit this config file

Edit C:\wamp\alias\phpmyadmin.conf

You need to make the same sort of chnage in here as you did above

Apache 2.2.x Change this

<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ::1
</Directory>

To

<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ::1
    Allow from 192.168.0
</Directory>

Apache 2.4.x

Change this

<Directory "c:/wamp/apps/phpmyadmin4.0.4/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
   Require local
</Directory>

To

<Directory "c:/wamp/apps/phpmyadmin4.0.4/">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride all
   Require local
   Require ip 192.168.0
</Directory>

If you can follow all that you should be able to access your site and phpmyadmin from your internal lan.

As to editing the source of your site, you will have to share the c:\wamp\www folder on your server and then map that share on the PC you are working on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!