1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Linux(CentOS 7)——阿里云 云服务器 ECS上Apache服务器安装与配置

Linux(CentOS 7)——阿里云 云服务器 ECS上Apache服务器安装与配置

时间:2021-07-23 03:07:46

相关推荐

Linux(CentOS 7)——阿里云 云服务器 ECS上Apache服务器安装与配置

基本概念

Apache:Apache HTTP服务器项目是为现代操作系统(包括UNIX和Windows)开发和维护开源HTTP服务器的一项工作。该项目的目标是提供一个安全,高效且可扩展的服务器,该服务器提供与当前HTTP标准同步的HTTP服务。

安装与配置

1、指令直接安装

yum install httpd # 中间过程中输入:y

2、修改配置文件:yum的安装位置在:/etc/httpd/conf

# 放掉95行的注释,修改为:ServerName [你的IP]:80

3、启动服务

systemctl start httpd.service

4、关闭服务

systemctl stop httpd.service

5、重启服务

systemctl restart httpd.service

6、设置开机自动启动

chkconfig httpd on

7、验证apache服务是否安装成功

在浏览器中输入你的主机外网IP地址,若安装成功则会出现一个Apache欢迎页面

如果不能连接上,需要设置防火墙

解决方法:

CentOS7用的是Firewall-cmd,CentOS7之前用的是iptables防火墙;要想让外网能访问到apache主目录,就需要做以下的操作:

firewall-cmd –permanent –zone=public –add-service=httpfirewall-cmd –permanent –zone=public –add-service=httpsfirewall-cmd –reload

如果上述方法不行也可以尝试把firewalld服务关闭换用CentOS 6以前的防火墙服务iptables,具体如下:

systemctl stop firewalld.service //关闭firewalldsystemctl start iptables.service //开启iptablessystemctl enable iptables.service //自启动iptables

还有很重要的一点是,要在你的阿里云服务器安全组里面设置允许外访问,否则无法从外部访问网站

参考文章

/leijiahui/article/details/88113196

/qq_41020714/article/details/88080192

/php-weizijiaocheng-403839.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。