apache配置(httpd)

apache配置

使服务端可以连接http httpd,端口80 443

http 协议的请求的完整域名是:

http://主机IP

配置

1、tar -xf httpd-2.4.29.tar.bz2 #解压源码包

2、安装依赖环境:yum install apr* gcc* pcre* -y #创建本地yum源,后安装依赖环境

PS:进入httpd-2.4.29目录中,再执行以下内容
3、./configure --prefix=/opt/apps/httpd #配置安装路径

以下下两步可一个命令进行 make && make instal
4、编译: make

5、安装:make install

记得此处拍快照,有问题可以节省时间

6、开启服务:
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
#关闭防火墙和安全机制

/opt/apps/httpd/bin/apachectl start 开启服务
/opt/apps/httpd/bin/apachectl stop 停止服务

curl 主机IP

安装完成

优化管理

1、做个软链接,优化路径
ln -s /usr/local/httpd/bin/*  /usr/local/bin

2、添加httpd系统服务
以下为添加systemctl 工具管理
vim /lib/systemd/system/httpd.service

[Unit]
Description=The Apache HTTP Server						#描述
After=network.target									#描述服务类别
[Service]
Type=forking											#后台运行方式
PIDFile=/opt/apps/httpd/logs/httpd.pid					        #PID文件位置
ExecStart=/usr/local/bin/apachectl $OPTIONS				#启动服务
ExecReload=/bin/kill -HUP $MAINPID						#根据PID重载配置
[Install]
WantedBy=multi-user.target

systemctl start httpd.service
systemctl enable httpd.service
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值