源码编译http

1.下载源码包上传到linux中

2.编译源码包安装apache软件

安装软件:yum install gcc gcc-c++ make -y

解压:tar xf httpd-2.4.62.tar.bz2 -C /usr/local/src/

指定组和用户:groupadd -r -g 48 apache

useradd -r -u 48 -g 48 -c "Apache server" -s /sbin/nologin apache

在 /usr/local/src/httpd-2.4.62目录下使用

./configure --prefix=/usr/local/apache

根据最下方的报错信息安装依赖

yum install -y apr-devel

继续使用./configure --prefix=/usr/local/apache并根据报错信息安装依赖

再次使用./configure --prefix=/usr/local/apache并根据报错信息安装依赖

现在就编译安装完成了

然后执行make和 make install

3.启动脚本

进入目录:cd /usr/local/apache/bin

cp apachectl /etc/init.d/httpd

在httpd文件中加入两行

#chkconfig: 35 80 10

#description: Apache is an HTTP(S) server

添加成系统服务:

chkconfig --level 35 --add httpd

设置开机自启:

chkconfig --level 35 httpd on

查看

第二种方式:

清除之前配置

chkconfig --level 35 httpd off

chkconfig --level 35 --del httpd

rm -f /etc/init.d/httpd

创建文件

vim /usr/lib/systemd/system/httpd.service

修改.conf文件用户,组

vim /usr/local/apache/conf/httpd.conf

相关推荐
moonless022220 小时前
FastAPI框架,这一小篇就能搞懂精髓。
http·fastapi
白帽黑客沐瑶2 天前
【网络安全就业】信息安全专业的就业前景(非常详细)零基础入门到精通,收藏这篇就够了
网络·安全·web安全·计算机·程序员·编程·网络安全就业
树码小子2 天前
Java网络编程:(socket API编程:TCP协议的 socket API -- 回显程序的服务器端程序的编写)
java·网络·tcp/ip
绿箭柠檬茶2 天前
Ubuntu 服务器配置转发网络访问
服务器·网络·ubuntu
FPGA_Linuxer2 天前
FPGA 40 DAC线缆和光模块带光纤实现40G UDP差异
网络协议·fpga开发·udp
real 12 天前
传输层协议UDP
网络·网络协议·udp
路由侠内网穿透2 天前
本地部署 GPS 跟踪系统 Traccar 并实现外部访问
运维·服务器·网络·windows·tcp/ip
喵手2 天前
玩转Java网络编程:基于Socket的服务器和客户端开发!
java·服务器·网络
徐子元竟然被占了!!2 天前
实验-基本ACL
网络
ftpeak2 天前
从零开始使用 axum-server 构建 HTTP/HTTPS 服务
网络·http·https·rust·web·web app