Linux rhel 6.4 apache編譯安裝以及簡單配置過程(2)

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後的簡單配置完成。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章