apche配置多少域名和二级域名
步骤如下:
1.你要拥有一个有泛域名解析的顶级域名,例如:abc.com
在dns服务上设置,域名服务商都提供此服务
www.abc.com指向服务器IP
abc.com指向服务器IP
a.abc.com指向服务器IP
设置完成后,分别
pingwww.abc.com;pingabc.com;pinga.abc.com。
如果返回的ip地址都是服务器IP,说明域名解析已经成功。
2.修改http.conf,或者修改httpd-vhosts.conf,如果后者要检查下
http.conf文件的Include"conf/extra/httpd-vhosts.conf"是否打开了。conf文件增加内容如下:
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:\xampp\htdocs\www" ServerName abc.com ServerAlias www.abc.com ErrorLog "C:\xampp\apache\logs\abc.localhost-error.log" CustomLog "C:\xampp\apache\logs\abc.localhost.access.log" combined </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:\xampp\htdocs\a" ServerName a.abc.com ErrorLog "C:\xampp\apache\logs\a.abc.localhost-error.log" CustomLog "C:\xampp\apache\logs\a.abc.localhost.access.log" combined </VirtualHost>
第一段是www.abc.com
第一段是a.abc.com
各个参数含义说明
ServerAdmin管理员邮箱
DocumentRoot所需指向路径
ServerName域名名称
ServerAlias域名别名可要可不要
ErrorLog错误日志
CustomLog访问日志
下面是成功的例子一个httpd-vhosts.conf里的内容
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot D:/dx/ ServerName www.dxs.gov.cn ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot D:/www/dxs ServerName xxgk.dxs.gov.cn ErrorLog logs/dummy-host1.example.com-error_log CustomLog logs/dummy-host1.example.com-access_log common </VirtualHost>
相关推荐
AderStep 2020-11-09
82550294 2020-09-01
书弋江山 2020-08-11
windzoone 2020-08-06
windzoone 2020-07-29
clmngu 2020-07-26
hxf0 2020-07-10
dahege 2020-06-22
niutingbaby 2020-06-14
tencentopen 2020-06-12
beiya 2020-06-03
zhangskd 2020-06-04
chwzmx 2020-05-29
岁月如歌 2020-05-19
末点 2020-05-17
oLeiShen 2020-05-15
zhangskd 2020-05-15