I have my files hosted on one computer acting as the server , but I want to access the root (www) directory files and the phpmyadmin from another computer on the lan.By access I mean to edit them and open them to see and make changes to the database and code.How is it possible?
问题:
回答1:
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.