Apache笔记

 

关闭selinux和防火墙

 

本机IP是192.168.16.250

 

 

 

安装apache

[root@localhost ~]# yum -y install httpd*      (安装)

[root@localhost ~]# rpm -qa | grep httpd     (查看)

httpd-manual-2.2.3-43.el5

httpd-2.2.3-43.el5

httpd-devel-2.2.3-43.el5

 

 

基于IP地址的虚拟主机

1.       [root@localhost ~]# mkdir -p /var/apache-cishi1       在var下面建立apache_cishi1目录

2.       [root@localhost apache-cishi1]# vim index.html                  

在apache-cishi1下面建立index.html并写入hello xiao jie!

3.       [root@localhost apache-cishi1]# ifconfig eth0:1 192.168.16.251    建立虚拟网卡

4.       [root@localhost apache-cishi1]# vim /etc/httpd/conf/httpd.conf       配置主配置文件

Apache  web服务器文档_职场
 

5.       [root@localhost ~]# yum -y install bind*     安装dns

6.       [root@localhost ~]# rpm -qa | grep bind     查看

bind-chroot-9.3.6-4.P1.el5_4.2

bind-libs-9.3.6-4.P1.el5_4.2

bind-devel-9.3.6-4.P1.el5_4.2

bind-libbind-devel-9.3.6-4.P1.el5_4.2

bind-utils-9.3.6-4.P1.el5_4.2

bind-9.3.6-4.P1.el5_4.2

ypbind-1.19-12.el5

bind-sdb-9.3.6-4.P1.el5_4.2

7.       [root@localhost ~]# vim /var/named/chroot/etc/named.conf        

   在/var/named/chroot/etc/下创建文件named.conf并进行配置

Apache  web服务器文档_职场_02

 

8.       [root@localapache-cishi1]#cp /usr/share/doc/bind-9.3.6/sample/var/named/localdomain.zo          ne /var/named/chroot/var/named/apache-cishi1.com.zone    从模板中复制

9.       [root@local ~]# vim /var/named/chroot/var/named/apache-cishi1.com.zone

Apache  web服务器文档_休闲_03

 

10.   [root@local ~]# service httpd restart     重启apache服务

[root@local ~]# service named restart    重启电脑上服务

 

 

最后进行测试即可。