版本: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个文件
二、配置步骤
① 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#
#/VirtualHost#
把#号换为< 或者 >