Apache 虚拟主机 VirtualHost 配置

简介: 转自:http://www.neoease.com/apache-virtual-host/ Windows 是市场占有率最高的 PC 操作系统, 也是很多人的开发环境. 其 VirtualHost 配置方法与 Linux 上有些差异, 以下方式适合原生 Apache, XAMPP 和 WAMP 套件.

转自:http://www.neoease.com/apache-virtual-host/

Windows 是市场占有率最高的 PC 操作系统, 也是很多人的开发环境. 其 VirtualHost 配置方法与 Linux 上有些差异, 以下方式适合原生 Apache, XAMPP 和 WAMP 套件.

1. 打开目录 {Apache2 安装目录}\conf\extra\, 找到 httpd-vhosts.conf 文件.

2. 仿照例子, 添加一段代码来指定某一域名的网站.

#
# DocumentRoot 是网站文件存放的根目录
# ServerName 是网站域名, 需要跟 DNS 指向的域名一致
#
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "D:/workspace/php/demo_neoease_com"
    ServerName demo.neoease.com
    ErrorLog "logs/demo.neoease.com-error.log"
    CustomLog "logs/demo.neoease.com-access.log" common
</VirtualHost>

3. 打开 httpd.conf 文件, 添加如下语句.

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

4. 重启 Apache 服务.

 

注:默认情况下新添加的虚拟主机的的路径是没有访问权限的,添加路径的访问的权限

例如:

<Directory "E:/Apache2.2/www.ee.com">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

目录
打赏
0
0
0
0
9
分享
相关文章
CentOS 7.2配置Apache服务httpd(上)
CentOS 7.2配置Apache服务httpd(上)
474 1
大数据-152 Apache Druid 集群模式 配置启动【下篇】 超详细!(一)
大数据-152 Apache Druid 集群模式 配置启动【下篇】 超详细!(一)
86 1
大数据-152 Apache Druid 集群模式 配置启动【下篇】 超详细!(一)
CORS跨域+Nginx配置、Apache配置
CORS跨域+Nginx配置、Apache配置
397 7
大数据-152 Apache Druid 集群模式 配置启动【下篇】 超详细!(二)
大数据-152 Apache Druid 集群模式 配置启动【下篇】 超详细!(二)
80 2
|
7月前
apache+tomcat配置多站点集群的方法
apache+tomcat配置多站点集群的方法
89 4
大数据-151 Apache Druid 集群模式 配置启动【上篇】 超详细!
大数据-151 Apache Druid 集群模式 配置启动【上篇】 超详细!
156 1
Tomcat负载均衡原理详解及配置Apache2.2.22+Tomcat7
Tomcat负载均衡原理详解及配置Apache2.2.22+Tomcat7
116 3
|
7月前
|
CentOS 7.2配置Apache服务httpd(下)
CentOS 7.2配置Apache服务httpd(下)
85 1
apache的主要目录结构及常见的配置选项的详细说明(图例展示)
apache的主要目录结构及常见的配置选项的详细说明(图例展示)
136 1

热门文章

最新文章

推荐镜像

更多
下一篇
oss创建bucket
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等