httpd源码安装

目录

准备

1,从官网下载httpd的2.4版本的压缩包

2,然后把下载好的压缩包传输给虚拟机

配置

把httpd的压缩包解压

​编辑

安装需要的环境

​编辑

在httpd目录下编译

之后使用make在编译

编译完成后在使用make install再一次编译安装

此时编译完成

做个链接,在bin里添加httpd

把启动服务复制到init.d下

修改文件的内容

修改为开机启动

检测

开启

关闭

方法二

在编译安装完成后可以

在 /etc/systemd/system/创建 httpd.service文件

内容为

重新加载 systemd 的守护进程,使新的服务文件生效


准备

1,从官网下载httpd的2.4版本的压缩包

地址:https://httpd.apache.org/

2,然后把下载好的压缩包传输给虚拟机

配置

把httpd的压缩包解压

安装需要的环境

在httpd目录下编译

之后使用make在编译

编译完成后在使用make install再一次编译安装

此时编译完成

做个链接,在bin里添加httpd

[root@localhost httpd]# ln -s /usr/local/httpd/bin/* /usr/local/bin/

把启动服务复制到init.d下

[root@localhost httpd]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd 

修改文件的内容

[root@localhost httpd]# cd /etc/init.d/
[root@localhost init.d]# ls
functions  httpd  README
[root@localhost init.d]# vim httpd 

修改为开机启动

检测

开启

关闭

方法二

在编译安装完成后可以

/etc/systemd/system/创建 httpd.service文件

/etc/systemd/system/httpd.service

内容为

[Unit]
Description=The Apache HTTP Server
After=network.target

[Service]
Type=forking
PIDFile=/usr/local/httpd/logs/httpd.pid
ExecStart=/usr/local/httpd/bin/httpd -k start
ExecReload=/usr/local/httpd/bin/httpd -k restart
ExecStop=/usr/local/httpd/bin/httpd -k stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target

重新加载 systemd 的守护进程,使新的服务文件生效

systemctl daemon-reload

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值