歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> CentOS 5.0以上不能搭建SSL不能make genkey

CentOS 5.0以上不能搭建SSL不能make genkey

日期:2017/2/28 16:10:56   编辑:Linux教程

在CentOS 5.0以上版本,SSL certificate相關的一些東西變換了位置

移至/etc/pki/tls/certs/

故操作變為如下操作:

1.

~]# yum -y install mod_ssl

~]# cd /etc/pki/tls/certs/

certs]# make server.key
certs]# openssl rsa -in server.key -out server.key
certs]# make server.csr
certs]# openssl x509 -in server.csr -out server.pem -req -signkey server.key -days 365
certs]# chmod 400 server.*

2.
certs]# vi /etc/httpd/conf.d/ssl.conf

#DocumentRoot "/var/www/html"  ← 找到這一行,將行首的“#”去掉
 ↓
DocumentRoot "/var/www/html"  ← 變為此狀態

3.

conf]# /etc/rc.d/init.d/httpd restart  ← 重新啟動HTTP服務器
Stopping httpd:               [ OK ]
Starting httpd:              [ OK ]

4.

設置防火牆允許SSL
[root@sample conf]# vi /etc/sysconfig/iptables   ← 編輯防火牆配置文件
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT  ← 找到這一行,接著添加如下行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT  ← 開放443號端口,允許SSL

5.
[root@sample conf]# /etc/rc.d/init.d/iptables restart   ← 重新啟動防火牆,www.linuxidc.com使設置生效
Flushing firewall rules:            [ OK ]
Setting chains to policy ACCEPT: filter    [ OK ]
Unloading iptables modules:         [ OK ]
Applying iptables firewall rules:       [ OK ]


6.

打開浏覽器,在地址欄輸入“https://服務器IP地址”或者“https://你的域名”後,如果出現提示安裝服務器證明書的窗口,說明服務器已經支持SSL。這時,如果選擇“永遠接受此證書”,然後點擊確定後,再次通過HTTPS協議訪問該站點,將不會再彈出此窗口提示安裝服務器證書。

Copyright © Linux教程網 All Rights Reserved