Linux服务器中如何配置apache支持ssl

Linux服务器中如何配置apache支持ssl

Linux服务器中如何配置apache支持ssl,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。

Apache支持ssl

1、检测是否安装ssl模块,如果没有就安装

[root@localhost cgi-bin]# rpm -qa | grep mod_ssl           //查看是否安装ssl模块

[root@localhost cgi-bin]# yum install -y mod_ssl           //安装ssl

Loaded plugins: fastestmirror, refresh-packagekit, security

Loading mirror speeds from cached hostfile                                 

Complete!

[root@localhost cgi-bin]# 

2、修改ssl的配置文件“/etc/httpd/conf.d/ssl.conf”如下,开启ssl,设置监听端口 

[root@localhost ~]# gedit /etc/httpd/conf.d/ssl.conf

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.  

LoadModule ssl_module modules/mod_ssl.so           //开启ssl功能

# When we also provide SSL we have to listen to the 

# the HTTPS port in addition.

Listen 443       //监听的端口

3、修改防火墙配置,开启对上面端口443的支持

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

      Linux服务器中如何配置apache支持ssl

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

      Linux服务器中如何配置apache支持ssl

     3)选择“添加“

      Linux服务器中如何配置apache支持ssl

     4)添加端口443,协议tcp,然后确定

      Linux服务器中如何配置apache支持ssl

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

      Linux服务器中如何配置apache支持ssl

6)重启防火墙

[root@localhost ~]# service iptables restart

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

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

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

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

[root@localhost ~]#

7)重启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 ~]# 

 

4、测试

     1)在浏览器输入 https://127.0.0.1 ,注意必须是“https“ ,看到如下结果

      Linux服务器中如何配置apache支持ssl

     2)选择“我已充分了解”,弹出如下对话框,选择“确认安全例外”就可以正常访问

      Linux服务器中如何配置apache支持ssl

 做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密码:n7bk

Linux服务器中如何配置apache支持ssl

看完上述内容,你们掌握Linux服务器中如何配置apache支持ssl的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!