WampServer开启虚拟主机

因为博客备份到本地,每次修改数据库改网址好麻烦,就想在本地也用域名访问。

因为我用wampserver,需要开启虚拟主机,过程如下:

1、打开http.conf文件

20140503-001

2、搜索vhosts,第一个是

 
 
  1. # Virtual hosts
  2. #Include conf/extra/httpd-vhosts.conf

将include前面的#号去掉就可以了。

2014-06-01_124049

3、继续搜索vhosts,第二个是

 
 
  1. IncludeOptional "E:/WAMP/vhosts/*"

请将这个前面的#号去掉,要不访问会出现403。

2014-06-01_125202

4、然后是虚拟主机配置,放置在安装目录的vhosts里,名字就取“域名.conf”

配置示例如下:

 
 
  1. localhost.conf
  2. <VirtualHost *:80>
  3.     ServerAdmin no-reply@localhost.com
  4.     DocumentRoot "E:/WAMP/www"
  5.     ServerName localhost
  6.     ServerAlias localhost
  7.     ErrorLog "logs/localhost-error.log"
  8.     CustomLog "logs/localhost-access.log" common
  9. </VirtualHost>
  10.  
  11. www.chaiwubi.com
  12. <VirtualHost *:80>
  13.     ServerAdmin no-reply@chaiwubi.com
  14.     DocumentRoot "E:/WAMP/www/CMS/chaiwubi"
  15.     ServerName chaiwubi.com
  16.     ServerAlias www.chaiwubi.com
  17.     ErrorLog "logs/chaiwubi.com-error.log"
  18.     CustomLog "logs/chaiwubi.com-access.log" common
  19. </VirtualHost>

2014-06-01_125348

<Directory "D:/phpweb/test/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>
<Directory "D:/phpweb/test2/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>
<Directory "D:/phpweb/jzcms/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值