歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

[部署]CentOS安裝apache

環境   虛擬機:VMWare10.0.1 build-1379776   操作系統:CentOS7 64位   步驟   1、使用yum安裝   yum install httpd httpd-devel 2、啟動   apachectl start 開機啟動服務安裝   1、在/etc/init.d目錄先建立httpd文件   vi /etc/rc.d/init.d/httpd httpd文件內容
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# Description: Apache is a World Wide Web server.  It is used to serve \
#           HTML files and CGI.
# processname: httpd
# Source function library.

. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
start)
echo -n "Starting httpd:"
/usr/sbin/apachectl start
;;
stop)
echo -n "Shutting down httpd:";
/usr/sbin/apachectl stop
;;
status)
/usr/sbin/apachectl status
;;
restart)
echo -n "Restarting httpd:";
/usr/sbin/apachectl restart
;;
reload)
echo -n "Reloading httpd: "
/usr/sbin/apachectl restart
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0

 

  2、修改/etc/rc.d/init.d/httpd的執行權限   chmod 755 /etc/rc.d/init.d/httpd 3、加入系統服務   chkconfig --add httpd chkconfig --levels 2345 httpd on
Copyright © Linux教程網 All Rights Reserved