一、安装Apache服务
1、查找Apache服务
yum search httpd

2、安装Apache服务
yum install httpd.x86_64
3、加入Apache服务到开机启动,同时启动Apache服务
systemctl enable httpd
systemctl start httpd
4、开通防火墙80,3306端口(测试这两个WEB服务)
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload

二、添加Apache 3306WEB服务
1、进入Apache配置目录
cd /etc/httpd/conf/
2、修改httpd.conf 增加监听端口3306

3、进入Apache通用配置目录
cd /etc/httpd/conf.d/
4、新增一个配置文件,以conf为扩展名,文件名随便取,加如下内容即可
<VirtualHost *:3306>
ServerAdmin root@localhost
DocumentRoot /var/www/8080/
ServerName localhost
ErrorLog logs/3306-error_log
CustomLog logs/3306-access_log common
DirectoryIndex index.html index.htm
</VirtualHost>
ServerAdmin:web站点管理员,我一般用centos超级管理员账号
DocumentRoot:web站点根目录,一般建立在Apache服务目录位置
ServerName:web站点服务器名字
ErrorLog:web站点错误日志
CustomLog:web站点访问日志
DirectoryIndex:web站点启动首页
三、重启Apache服务
systemctl restart httpd
netstat -lantp,如下图证明启动成功,我是用8080做的测试

1875

被折叠的 条评论
为什么被折叠?



