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”,在彈出的框中選擇“防火牆”,接着選擇“定制”

      

      2)使用空格鍵選中”https“,接着選擇“轉發”

      

     3)選擇“添加“

      

     4)添加端口443,協議tcp,然后確定

      

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

      

     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“ ,看到如下結果

      

     2)選擇“我已充分了解”,彈出如下對話框,選擇“確認安全例外”就可以正常訪問

      

 

 

 

 做了一個Linux學習的平台,目前出來一個雛形,各位可以參考使用
鏈接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密碼:n7bk

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM