Apache配置虚拟主机httpd-vhosts.conf
2016-05-24 16:12
609 查看
版本:Apache2.4.x
一、配置虚拟主机需要3个文件
1、Apache/conf/httpd.conf
2、Apache/conf/extra/httpd-vhosts.conf(这个地版本的apache可能没有,可自己创建,也可以不要此文件,
而将配置直接写在httpd.conf里面,写在extra/httpd-vhosts.conf只是为了管理方便,不让httpd.conf文件内容很多而已)
3、C:\WINDOWS\system32\drivers\etc\hosts
二、配置步骤
① httpd.conf 找到VirtualHost example,在后面引入httpd-vhosts.conf文件:
Include conf/extra/httpd-vhosts.conf
这个句话,高版本的apache里面已经写有了,只需吧Include前面的#号去掉就OK
② httpd-vhosts.conf配置文件的内容如下:
#
# DocumentRoot 是网站文件存放的根目录
# ServerName 是网站域名, 需要跟 DNS 指向的域名一致
#
####################### my.iwebshop.com ####################
#VirtualHost *:80#
ServerAdminwebmaster@iwebshop.com
DocumentRoot"e:/iwebshop"
ServerNamemy.iwebshop.com
ErrorLog"logs/my.iwebshop.com-error.log"
CustomLog"logs/my.iwebshop.com-access.log" common
#Directory"e:\iwebshop"#
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
#/Directory#
#/VirtualHost#
把#号换为< 或者 >
一、配置虚拟主机需要3个文件
1、Apache/conf/httpd.conf
2、Apache/conf/extra/httpd-vhosts.conf(这个地版本的apache可能没有,可自己创建,也可以不要此文件,
而将配置直接写在httpd.conf里面,写在extra/httpd-vhosts.conf只是为了管理方便,不让httpd.conf文件内容很多而已)
3、C:\WINDOWS\system32\drivers\etc\hosts
二、配置步骤
① httpd.conf 找到VirtualHost example,在后面引入httpd-vhosts.conf文件:
Include conf/extra/httpd-vhosts.conf
这个句话,高版本的apache里面已经写有了,只需吧Include前面的#号去掉就OK
② httpd-vhosts.conf配置文件的内容如下:
#
# DocumentRoot 是网站文件存放的根目录
# ServerName 是网站域名, 需要跟 DNS 指向的域名一致
#
####################### my.iwebshop.com ####################
#VirtualHost *:80#
ServerAdminwebmaster@iwebshop.com
DocumentRoot"e:/iwebshop"
ServerNamemy.iwebshop.com
ErrorLog"logs/my.iwebshop.com-error.log"
CustomLog"logs/my.iwebshop.com-access.log" common
#Directory"e:\iwebshop"#
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
#/Directory#
#/VirtualHost#
把#号换为< 或者 >
相关文章推荐
- java网络-Socket
- Volley网络通信框架
- HTTPD::Log::Filter
- okhttp框架的封装
- OkHttp使用手册
- 网络端口号分类
- ip udp tcp 报文格式
- 《图解HTTP》学习笔记(一)-了解Web及网络基础
- Http断点下载实简单讲解
- 博客迁移至 http://www.loveli.site
- socket用在主线程中
- VirtualBox虚拟机网络怎么设置 VirtualBox虚拟机网络设置详细教程
- 支持IPv6 DNS64 / NAT64网络
- c语言实现TCP的socket通信
- 网络通信之HTTP
- HTTPS那些事 用java实现HTTPS工作原理
- HTTP工作原理及HTTP请求、响应报文解读
- 高性能 TCP & UDP 通信框架 HP-Socket v3.5.1 发布
- cmd连接网络数据库
- git 由http切换成git