xamppv3.2.1 在本地Windows上配置多域名、多ip段,无需修改host,windows本地多虚拟主机的正确设置教程127.0.0.9/127.0.0.8

之前一直用phpnow添加的虚拟主机,后来看xampp的php版本比较多,就改用了xampp,由于项目较多,始终切换同一个 127.0.0.1也不好,网上找了一些资料,但是大多都有问题,配置无效

 

多数时候会提示403等 如下错误

 

 

Access forbidden!
 
You don't have permission to 
access the requested directory. There is either no index document or the
 directory is read-protected.
 
If you think this is a server error, please contact the webmaster.
 
Error 403

  

最终解决方案:

 

在 apache/conf/extra/httpd-vhosts.conf  里 添加如下代码

 

<VirtualHost *:80>
DocumentRoot "网站路径"
<Directory "网站路径">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
ServerName 本地的ip段
</VirtualHost>

 

# Virtual Hosts
#
# Required modules: mod_log_config
 
 
 
NameVirtualHost *
 
 
<VirtualHost *:80>
DocumentRoot "F:/mysite/jourmy_website"
<Directory "F:/mysite/jourmy_website">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
ServerName 127.0.0.10
</VirtualHost>
 
<VirtualHost *:80>
DocumentRoot "F:/mysite/jourmy_website2"
<Directory "F:/mysite/jourmy_website2">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>
ServerName 127.0.0.8
</VirtualHost>

  

经测试,在浏览器中可以 通过输入  127.0.0.10  和 127.0.0.8  分别访问不同的站点

 

帮助您提升开发速度

 

转自http://www.jourmy.cn/html/122.html

上一篇:拜托,面试请不要再问我分布式搜索引擎的架构原理!


下一篇:ubuntu+ apache2+cgi配置(自己摸索了两天)解决(空白页,forbiden, internal server error )赠于python初学者