apache搭建虚拟主机
apache搭建虚拟主机有两方法。第一步完成apache虚拟目录配置;
第二步到httd.conf里面找到
# Virtual hosts 虚拟主机
Include conf/extra/httpd-vhosts.conf
找到后去掉#注释.
第三步打开 conf/extra/httpd-vhosts.conf 文件
接下来有两种配置方法。
1-添加下面代码
[*]
[*] ServerAdmin webmaster@dummy-host.example.com
[*] DocumentRoot "D:/myblog"//这里的d就是你虚拟目录的位置了
[*] ServerName www.lengai.com //这里是你要映射的域名
[*] ErrorLog "logs/demo.neoease.com-error.log"
[*] CustomLog "logs/demo.neoease.com-access.log" common
[*]
重启apache就ok了.
2-添加下面代码
[*] //这里的ip地址要注意。这样配置其他电脑是连接不到的。必须改为网卡地址。
[*] DocumentRoot "D:/myblog" //虚拟目录地址
[*] DirectoryIndex index.html index.htm index.php
[*] //权限
[*] Options FollowSymLinks
[*] Allowoverride None
[*] order Allow,deny
[*] Allow from all
[*]
[*]
重启apache可以了
个人更喜欢第一种方法。
页:
[1]