Article

-- All Article

Httpd启用虚拟主机

未知
>### Httpd 启用虚拟主机 ### >#### 找到apache 的httpd.conf 配置文件 #### >#### 找到 ####
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
>#### 改为,去掉引号 启用虚拟主机配置文件 ####
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
>#### 打开httpd-vhosts.conf #### >#### 按如下示例配置apache ####

## ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##
>#### 如果多个虚拟主机启用的时候提示 以下信息 ####
[warn] _default_ VirtualHost overlap on port 80, the first has precedence

>请检查NameVirtualHost *:80 前边的# 是否去掉 位置一般在虚拟主机目录配置的前几行 2.4版本不需要设置此项 ServerAlias 为别名解析及泛域名解析
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
ServerAdmin hykj@163.com
DocumentRoot /www/wwwroot
ServerName 123.56.76.85
ErrorLog logs/123.56.76.85-log
CustomLog logs/123.56.76.85-access_log common

ServerAdmin itzcy@itzcy.com
DocumentRoot /www/wyxgongju
ServerName www.wyxgongju.com
ServerAlias www2.wyxgongju.com
ErrorLog logs/wyxgongju-error_log
CustomLog logs/wyxgongju-access_log common

ServerAdmin itzcy@itzcy.com