从lan上的另一台计算机访问wamp中的网站文件和phpmyadmin

时间:2013-10-16 11:17:47

标签: database apache phpmyadmin wamp wampserver

我的文件托管在一台充当服务器的计算机上,但我想从lan上的另一台计算机访问root(www)目录文件和phpmyadmin。通过访问我的意思是编辑它们并打开它们看看并对数据库和代码进行更改。怎么可能?

1 个答案:

答案 0 :(得分:6)

默认情况下,WAMPServer配置为独立的开发系统,可在您的工作站上运行。

如果您想在一台PC上运行Wamp并从另一台PC访问它,您必须更改Apache安全配置。

你没有提到任何有用的东西,比如你正在运行的WampServer版本,所以我想我必须记录这两个选项

编辑httpd.conf(使用wampmanager菜单)

如果是Apache 2.2.x

找到此部分,为简洁起见,我删除了所有评论。

<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>

更改为:

<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>

如果Apache 2.4.x 找到这个部分

<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>

更改为:

<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>

现在要获得对phpMyAdmin的访问权限,您必须编辑此配置文件

编辑C:\ wamp \ alias \ phpmyadmin.conf

你需要在这里制作与上面相同的chnage

Apache 2.2.x 改变这个

<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>

<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

更改此

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

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

如果您可以遵循所有这些,您应该可以从内部局域网访问您的网站和phpmyadmin。

关于编辑网站的来源,您必须在服务器上共享c:\ wamp \ www文件夹,然后将该共享映射到您正在使用的PC上。