|
发表于 2009-1-9 17:37:50
|
显示全部楼层
配置如下:
[root@csmy ~]# ifconfig eth0 192.168.39.2 netmask 255.255.255.0 up//设置IP地址
[root@csmy named]# rpm -qa|grep httpd//查看apache安装状态
httpd-2.2.3-11.el5_1.3
httpd-manual-2.2.3-11.el5_1.3
[root@csmy ~]# vi /etc/httpd/conf/httpd.conf//编辑httpd.conf
修改内容如下:
Listen 192.168.39.2:80
ServerAdmin csmy@college.edu
ServerName csmywww.college.edu:80
添加虚拟主机:
NameVirtualHost 192.168.39.2:80
<VirtualHost csmywww.college.edu>
ServerAdmin csmy@college.edu
DocumentRoot /var/www/html/csmywww
ServerName csmywww.college.edu
ErrorLog /var/log/httpd/csmywww/error_log
CustomLog /var/log/httpd/csmywww/access_log common
</VirtualHost>
<VirtualHost research.college.edu>
ServerAdmin csmy@college.edu
DocumentRoot /var/www/html/research
ServerName research.college.edu
ErrorLog /var/log/httpd/research/error_log
CustomLog /var/log/httpd/research/access_log common
</VirtualHost>
<VirtualHost office.college.edu>
ServerAdmin csmy@college.edu
DocumentRoot /var/www/html/office
ServerName office.college.edu
ErrorLog /var/log/httpd/office/error_log
CustomLog /var/log/httpd/office/access_log common
</VirtualHost>
<VirtualHost teach.college.edu>
ServerAdmin csmy@college.edu
DocumentRoot /var/www/html/teach
ServerName teach.college.edu
ErrorLog /var/log/httpd/teach/error_log
CustomLog /var/log/httpd/teach/access_log common
</VirtualHost>
[root@csmy ~]# cd /var/www/html///建立网页主页文件夹
[root@csmy html]# ls
[root@csmy html]# mkdir csmywww
[root@csmy html]# mkdir office
[root@csmy html]# mkdir teach
[root@csmy html]# mkdir research
[root@csmy html]# cd csmywww/
[root@csmy csmywww]# vi index.html//编辑主页
[root@csmy csmywww]# cd ..
[root@csmy html]# cd office/
[root@csmy office]# vi index.html//编辑主页
[root@csmy office]# cd ..
[root@csmy html]# cd teach/
[root@csmy teach]# vi index.html//编辑主页
[root@csmy teach]# cd ..
[root@csmy html]# cd research/
[root@csmy research]# vi index.html//编辑主页
[root@csmy research]# cd /var/log/httpd///建立错误日志文件
[root@csmy httpd]# ls
access_log error_log ssl_access_log ssl_error_log.1
access_log.1 error_log.1 ssl_error_log ssl_request_log
[root@csmy httpd]# mkdir csmywww
[root@csmy httpd]# mkdir office
[root@csmy httpd]# mkdir teach |
|