在云服务器上安装Apache
环境
操作系统: CentOS Linux release 8.2.2004 (Core)
yum源安装
安装命令: yum install httpd  输入y 确认安装 
启动服务
启动服务命令: service httpd start  注意: 这一步中可能会出现如下错误: 
- 错误原因: 可以看到是端口无法绑定(Apache默认端口为80)的问题, 说明80端口已被占用; 也可以根据提示执行命令
systemctl status httpd.service 找出错误原因. - 解决方法:
可以通过执行netstat -punta | grep LISTEN 找到占用80端口的程序后修改解决. 我们选择另一种方法: 直接更改Apache的默认配置. 首先查找httpd.conf配置文件的存放路径: find /etc/httpd/ -name *conf  找到后更改配置文件: vim /etc/httpd/conf/httpd.conf 找到 Listen 80 更改为想要的端口, 比如8080. 然后 ESC + :wq 退出并保存编辑.
再次运行service httpd start  关闭服务命令是service httpd stop
安装完成
|