基本工具
yum install -y gcc gcc-c++ yum install -y expat-devel zlib-devel openssl-devel yum install -y libtool
AI 代码解读
安装APR
git clone https://gitee.com/apache/apr.git cd apr/ ./buildconf ./configure --prefix=/usr/local/apr make && make install
AI 代码解读
安装HTTP
下载: https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.gz
解压: tar -zxvf httpd-2.4.52.tar.gz
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr make && make install
AI 代码解读
编辑配置文件: /usr/local/httpd/conf/httpd.conf
Listen 2022 ServerName 172.xx.xx.xx:2022
AI 代码解读
服务启动
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
编辑: vim /etc/init.d/httpd
加入:
# chkconfig: 345 85 15 # description: Activates/Deactivates Apache Web Server
AI 代码解读
运行命令: systemctl enable httpd
启动命令: service httpd start
访问验证
查看CentOS版本: cat /etc/redhat-release
查看端口是否启动: netstat -ltpn
浏览器访问: http://172.xx.xx.xx:2022/ 展示:It works!
防火墙命令
service iptables status service iptables stop service iptables start
AI 代码解读