部署多个站点,用不同的域名和站点目录。不同的端口,不同的ip。
基于域名 端口 ip
www.hequan.com /var/html/www
blog.hequan.com /var/html/blog
bbs.hequan.com /var/html/bbs
# mkdir /var/html/{www,blog,bbs} -p
# for name in www blog bbs; do echo "http://$name.hequan.com" > /var/html/$name/index.html; done
extra]# vim httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin hequan@lenet.com.cn
DocumentRoot "/var/html/www"
ServerName www.hequan.com
ServerAlias hequan.com
ErrorLog "logs/www-error_log"
CustomLog "logs/www-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin hequan@lenet.com.cn
DocumentRoot "/var/html/blog"
ServerName blog.hequan.com
ErrorLog "logs/blog-error_log"
CustomLog "logs/blog-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin hequan@lenet.com.cn
DocumentRoot "/var/html/bbs"
ServerName bbs.hequan.com
ErrorLog "logs/bbs-error_log"
CustomLog "logs/bbs-access_log" common
</VirtualHost>
vi httpd.conf
Include conf/extra/httpd-vhosts.conf
<Directory "/var/html"> 目录权限
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
出问题看日志
FQDN 域名
# If your host doesn‘t have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
本文出自 “何全” 博客,请务必保留此出处http://hequan.blog.51cto.com/5701886/1765392
原文地址:http://hequan.blog.51cto.com/5701886/1765392