[部署]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

转载于:https://www.cnblogs.com/binking338/p/4792523.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值