1. 配置网站
进入WampServer安装目录,一次打开wamp\bin\apache\apache2.4.9\conf\extra,编辑httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
管理员邮箱地址
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
网站代码目录
ServerName dummy-host2.example.com
主机名
ErrorLog "logs/dummy-host2.example.com-error.log"
错误日志
CustomLog "logs/dummy-host2.example.com-access.log" common
日常日志
</VirtualHost>
2. 由于httpd-vhosts.conf为扩展文件,默认情况不会被加载,配置httpd.conf
搜索httpd-vhost,将#Include conf/extra/httpd-vhosts.conf前的#注释去除
3. 由于Apache默认拒绝外部主机地址访问服务器资源:
2.2.1版本搜索Allow from 127,0,0,1,将Deny from all改为Allow from all,注释#Allow from 127,0,0,1
2.4.9版本搜索AllowOverride all,添加 Require all granted #添加允许外部访问;在其下方# onlineoffline tag - don't remove,注释# Require local #注释请求本机访问