2010年(23)
分类: LINUX
2010-06-06 16:00:53
搭建虚拟主机
1. 基于域名的虚拟主机
a. 新建目录/usr/local/apache/htdocs/123
b. 在123目录下面新建文件index.html 内容:123.com
c. 新建目录/usr/local/apache/htdocs/456
d. 在456目录下面新建文件index.html 内容:456.com
e. 修改/usr/local/apache/conf/httpd.conf在文件的最后加入内容如下
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /usr/local/apache/htdocs/123
ServerName
ErrorLog logs /dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /usr/local/apache/htdocs/456
ServerName
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
f. 测试在浏览器里面分别输入 ;查看网页是否能正常显示。(注意:在做这些之前,必须搭建好dns服务器,解析好和 )
2. 基于ip的虚拟主机:
a.前四部跟上面一样,
b.第五步:修改/usr/local/apache/conf/httpd.conf在文件的最后加入内容如下
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /usr/local/apache/htdocs/123
ServerName 10.100.100.172
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /usr/local/apache/htdocs/456
ServerName 10.100.100.182
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
2. 基于端口的虚拟主机:(先让学生自己做)