温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux服务器安装apache的过程

发布时间:2021-08-30 21:27:16 来源:亿速云 阅读:233 作者:chen 栏目:建站服务器

本篇内容主要讲解“Linux服务器安装apache的过程”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Linux服务器安装apache的过程”吧!

Apache安装   

1、安装Apache,使用命令“yum install httpd -y

[root@localhost ~]# yum install httpd -y

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile

base                                                    | 4.0 kB     00:00 ... 

Setting up Install Process

2、启动apache

[root@localhost ~]# service httpd start

正在启动 httpdhttpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

                                                          [确定]

[root@localhost ~]#

3、设置apache开机自启

[root@localhost ~]# chkconfig --level 5 httpd on 

[root@localhost ~]# chkconfig --list httpd

httpd          0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:启用  6:关闭

[root@localhost ~]# 

4、修改防火墙

想要其他机器访问到该主机的apache,要么关闭防火墙,要么就修改防火墙的配置

1)关闭防火墙,

在终端输入setup命令

[root@localhost ~]# setup

      弹出窗口,选择防火墙

       Linux服务器安装apache的过程

       弹出窗口,用空格关闭防火墙,保存退出(有*是启动)

       Linux服务器安装apache的过程

       2)修改防火墙配置,

       在终端输入命令“setup”,在弹出的框中选择“防火墙”,接着选择“定制”

        Linux服务器安装apache的过程

       使用空格键选中“http“、”https“,接着选择“转发”

       Linux服务器安装apache的过程 

       选择“添加“

       Linux服务器安装apache的过程 

       添加端口80,协议tcp,然后确定

        Linux服务器安装apache的过程

       回到最初的界面,“确定”

        Linux服务器安装apache的过程

重启防火墙

[root@localhost ~]# service iptables restart

iptables:将链设置为政策 ACCEPTfilter nat                [确定]

iptables:清除防火墙规则:                                 [确定]

iptables:正在卸载模块:                                   [确定]

iptables:应用防火墙规则:                                 [确定]

[root@localhost ~]#

重启apache

[root@localhost ~]# service httpd restart

停止 httpd                                              [确定]

正在启动 httpdhttpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

                                                          [确定]

[root@localhost ~]# 

 

5、测试,在其他局域网电脑输入本机的ip地址,看到如下界面代表apache安装成功

      Linux服务器安装apache的过程

到此,相信大家对“Linux服务器安装apache的过程”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI