Linux rhel 6.4 apache编译安装以及简单配置过程(2)

注:以下摘取的都是安装过程中执行的命令,命令反馈没有贴出来以"......"代替。观看的时候注意执行命令时所在的目录。

将apache的科执行程序软连接到/usr/local/bin下(可执行命令放到$PATH包含的路径,方便执行apache的命令)

[root@chengmanyu init.d]# ln -s /usr/local/apache/bin/* /usr/local/bin


将httpd加入到chkconfig中

service的管理命令都是在/etc/init.d下的

[root@chengmanyu init.d]# cp /usr/local/apache/bin/apachectl /etc/init.d/http(apache自动启动脚本)

为服务脚本加固定的台头

[root@chengmanyu init.d]# vim httpd

在#!/bin/sh下面添加下面两行

#chkconfig: 2345 85 15

#description:Apache is a world wide web server.

将httpd加入到service的管理器中

[root@chengmanyu init.d]# chkconfig --add httpd

查看下启动结果

[root@chengmanyu init.d]# chkconfig --list httpd

httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off



修改配置文件中的主机名(可以不改)

[root@chengmanyu init.d]# vi /usr/local/apache/conf/httpd.conf

找到ServerName一行去掉#号注释,然后添加主机名:80或者IP:80

ServerName 192.168.1.100:80


为了方便下次编译 可以给httpd.conf做个软连接

[root@chengmanyu init.d]# ln -s /usr/local/apache/conf/httpd.conf /etc/htppd.conf


修改完成后启动httpd

[root@chengmanyu init.d]# service httpd start

[root@chengmanyu init.d]#

启动后没有任何提示,我们检查一下

[root@chengmanyu init.d]# netstat -anpt | grep httpd

tcp        0      0 :::80                       :::*                        LISTEN      30387/httpd


至此安装apache后的简单配置完成。