把編譯安裝的httpd 實現服務指令碼,通過service和chkconfig 進行管理,httpdchkconfig

來源:互聯網
上載者:User

把編譯安裝的httpd 實現服務指令碼,通過service和chkconfig 進行管理,httpdchkconfig

把編譯安裝的httpd 實現服務指令碼,通過service和chkconfig 進行管理

1 編譯安裝httpd

    把httpd編譯安裝在/app/httpd/目錄下。

2 在/etc/rc.d/init.d/目錄下建立一個檔案httpd

這個檔案的目的在於讓service 命令可以管理編譯安裝的httpd服務。

    檔案內容如下:

[root@CentOS68 ~]# cat /etc/rc.d/init.d/httpd#!/bin/bash## httpd        Start up the httpd server daemon## chkconfig: 2345 99 01# description: httpd is a protocol for web server.# This service starts up the httpd server daemon.## processname: httpdcase $1 instart)    /app/httpd/bin/apachectl start ;;stop)    /app/httpd/bin/apachectl stop ;;status)    /app/httpd/bin/apachectl status ;;*)    echo erresac

3 添加為開機啟動

[root@CentOS68 /app/httpd/bin]# chkconfig --add httpd[root@CentOS68 /app/httpd/bin]# chkconfig --list |grep httpdhttpd     0:off    1:off    2:on    3:on    4:on    5:on    6:off

可以看到已經添加成功

4 通過service 命令啟動服務

[root@CentOS68 ~]# service httpd starthttpd: Could not reliably determine the server's fully qualified domain name, using CentOS68.localhost for ServerName

可以看到會報錯,但是服務已經啟動成功了,修改/app/httpd/conf/httpd.conf這個檔案,把98行前面的#去掉即可

98 #ServerName www.example.com:80

現在可以通過service命令管理手動安裝的httpd 服務了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.