我使用的xampp
1、修改C:\Windows\System32\drivers\etc中的hosts文件,添加127.0.0.1 www.feiquan.com
2、修改D:\xampp\apache\conf\extra中的httpd-vhosts.conf,添加
<VirtualHost *:>
DocumentRoot "网站路径"
ServerName www.feiquan.com
ErrorLog "logs/www.feiquan.com-error.log"
CustomLog "logs/www.feiquan.com-access.log" common
</VirtualHost>
3. 配置D:\xampp\apache\conf\httpd.conf
3.1:将Listen 80给为Listen 自己的ip:80
3.2将Servername localhost:80改为 自己的ip:80
3.3在文件最后添加:
<Directory "网站路径">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
3.4如果还不行 ,那可能还需要配置xampp\apache\conf\extra\httpd-xampp.conf中的httpd-xampp.conf
按3.3的方法,将Deny改为Allow
重启apache服务。