编译安装apache
yum install -y gcc gcc-c++ make
yum install -y apr-devel* pkgconfig* libapr* apr-util* pcre*
tar zxvf httpd-*.tar.gz -C /data #解压源码包,解压目录自行选定
cd /data/httpd* #切换到解压后的目录
./configure --prefix=/usr/local/apache #配置软件模块(安装路径、开启或关闭模块功能、管理服务进程的用户设定)
make && make install #编译并安装
vim /usr/local/apache/conf/httpd.conf #配置文件路径
/usr/local/apache/bin/apachectl start #启动httpd服务
curl http://IP #测试 httpd 服务是否启动
yum -y install lynx elinks
lynx IP
elinks IP
#configure 参数选项参考
http://nginx.org/en/docs/configure.html #官方文档
https://www.cnblogs.com/damoblog/p/13720216.html
————————————————————————————————————
添加 httpd 服务器自启动
vim httpd
#!/bin/bash
# chkconfig: 12345 80 90
function start_http()
{
/usr/local/apache/bin/apachectl start
}
function stop_http()
{
/usr/local/apache/bin/apachectl stop
}
case "$1" in
start)
start_http
;;
stop)
stop_http
;;
restart)
stop_http
start_http
;;
*)
echo "Usage : start | stop | restart"
;;
esac
#赋权并且加入系统服务
chmod a+x httpd
cp -arf httpd /etc/init.d/
启动自己编写的服务:
systemctl daemon-reload //重新加载
systemctl start httpd //启动httpd服务
systemctl stop httpd //关闭httpd服务
systemctl status httpd //查看httpd服务状态
设置开机自启动:
chkconfig --add httpd
chkconfig --list httpd #单独查看某一服务是否开机启动的命令
配置文件路径:
/usr/local/apache/conf/httpd.conf