1,用记事本打开apache目录下httpd文件(如:D:\wamp\bin\apache\apache2.2.8\conf),找到如下模块 # Virtual hosts #Includeconf/extra/httpd-vhosts.conf 去掉前面的#,这样就开启了httpd-vhosts虚拟主机文件...
1,用记事本打开apache目录下httpd文件(如:D:\wamp\bin\apache\apache2.2.8\conf),找到如下模块
# Virtual hosts
#Includeconf/extra/httpd-vhosts.conf
去掉前面的#,这样就开启了httpd-vhosts虚拟主机文件。这时候重启wamp环境,无法打开localhost,需要在httpd-vhosts.conf配置一下。
2,打开host文件(C:\WINDOWS\system32\drivers\etc\hosts),增加一行代码
127.0.0.1 szyqbbs.com
3,用记事本打开httpd-vhosts文件,配置好localhost虚拟主机,参照httpd-vhosts文件中实例,修改成如下:
<VirtualHost *:80> DocumentRoot "D:/wamp/www" ServerName myserver.com </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@youremail.com DocumentRoot "d:/www/szyqbbs" ServerName szyqbbs.com ErrorLog "logs/your_web_error.log" CustomLog "logs/your_web_access.log" common </VirtualHost>
修改配置如下:
DocumentRoot 修改为本地wamp环境下的www目录(如:D:\wamp\www)
ServerName改为localhost或者自定义的server如server.com
4,在浏览器中打开test.biuuu.com,发现如下错误403 Forbidden错误
Forbidden
You don‘t have permission to access / on this server.
分析:这主要是目录访问权限没有设置,需要设置对目录的访问权!
5,打开httpd文件,加入 如下语句
<Directory "D:/www/"> Options Indexes FollowSymlinks AllowOverride All Require all granted </Directory>
6,重启Apache,虚拟主机配置成 功!
注意事项
1,目录路径,如E:\WebRoot\biuuu
2,访问权限,如上Deny from all修改为allow from all
3,host文件,配置虚拟域名host指向
4,httpd文件,打开Include conf/extra/httpd-vhosts.conf模块
5,httpd-vhosts文件,配置虚拟主机
原文:http://www.cnblogs.com/weizaiyes/p/7105030.html
织梦狗教程
本文标题为:apache2.4.X虚拟主机配置
基础教程推荐
猜你喜欢
- Docker容器操作方法详解 2022-11-13
- Centos 安装Django2.1 2023-09-24
- Centos7 nginx的安装以及开机自启动的设置 2023-09-22
- RFO SIG之openEuler AWS AMI 制作详解 2022-12-28
- windows环境下apache-apollo服务器搭建 2023-09-10
- 通过StatefulSet部署有状态服务应用实现方式 2022-10-01
- Apache CarbonData 1.0.0发布及其新特性介绍 2023-09-11
- P3 利用Vulnhub复现漏洞 - Apache SSI 远程命令执行漏洞 2023-09-10
- Apache Kafka 2.5 稳定版发布,新特性抢先看 2023-09-11
- 为Win2003服务器打造铜墙铁壁的方法步骤 2022-09-01