日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > centos >内容正文

centos

Centos6.8上httpd配置腾讯云SSL证书

發(fā)布時間:2024/1/17 centos 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Centos6.8上httpd配置腾讯云SSL证书 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

(1)先按裝mod_ssl

yum -y install mod_ssl

?/etc/httpd/conf.d/下會有一個ssl.conf的文件,打開

a)檢測本地證書配置是否正確

? 主要是看下證書及密鑰的位置
? SSLCertificateFile /etc/pki/tls/certs/localhost.crt
? SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

? 1)生成證書
? ?進(jìn)入/etc/pki/tls/private,

rm -f localhost.key openssl genrsa 1024 > localhost.key #生成新的localhost.key 切換文件夾 cd ../certs rm -rf localhost.crt #刪除原來的證書 openssl req -new -x509 -days 365 -key ../private/localhost.key -out localhost.crt #生產(chǎn)新文件夾

填寫需要填寫的信息,生產(chǎn)證書。

說明:localhost.crt這樣的名子,是因為在ssl.conf是這樣指定的,這兩個地方要同步

重啟apache,配置結(jié)束
現(xiàn)在就可以通過https訪問網(wǎng)站

打開端口443:

iptables -I INPUT -p TCP –dport 443 -j ACCEPT 或 iptables -I INPUT -p TCP –dport 443 -j ACCEPT

注意:阿里云服務(wù)商要配置開放https需要使用的443端口的入規(guī)則

Apache下設(shè)置自動將http跳轉(zhuǎn)到https方法:

首先在網(wǎng)站根目錄下創(chuàng)建.htaccess文件,并寫入

RewriteEngine on RewriteBase / RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

或者在httpd.conf中啟用重寫,啟動重定向,使用用戶HTTP訪問自動重定向為HTTPS,直接在http.conf最后配置即可,在httpd.conf文件尾加入如下內(nèi)容

RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]

現(xiàn)在在瀏覽器中訪問,會提示不安全的鏈接,接下來引入騰訊云的ssl證書

(2)配置ssl.conf ,貼上源碼

? ? ? 1.上傳證書到服務(wù)器/etc/httpd/conf/cert/目錄下LoadModule ssl_module modules/mod_ssl.soListen 443

? ? ? 2.ssl.conf配置如下:

SSLPassPhraseDialog builtin SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000) SSLSessionCacheTimeout 300 SSLMutex default SSLRandomSeed startup file:/dev/urandom 256 SSLRandomSeed connect builtin SSLCryptoDevice builtin SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW:!RC4:<VirtualHost _default_:443> # 必須有一個虛擬主機,這樣才可以使用跳轉(zhuǎn)功能和使用443端口訪問 DocumentRoot "/home/store/www" ServerName www.zyin8.com:443 #
DirectoryIndex index.html index.php ?index.html.var
ErrorLog logs/ssl_error_log TransferLog logs/ssl_access_log LogLevel warn SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW:!RC4:
SSLCertificateFile /etc/httpd/conf/cert/2_www.zyin8.com.crt #證書 SSLCertificateKeyFile /etc/httpd/conf/cert/3_www.zyin8.com.key #秘鑰
SSLCertificateChainFile /etc/httpd/conf/cert/1_root_bundle.crt #鏈接
</VirtualHost>

? ? ? ? 3.service httpd restart

? ? ? 在瀏覽器輸入https://域名 或者 域名:443,如果兩個能正常訪問,表示https已經(jīng)配置成功。

? ? ? 在瀏覽器輸入 域名,如果能夠正常跳轉(zhuǎn)到https連接上,那說明跳轉(zhuǎn)功能正常。

轉(zhuǎn)載于:https://www.cnblogs.com/shione/p/7266146.html

總結(jié)

以上是生活随笔為你收集整理的Centos6.8上httpd配置腾讯云SSL证书的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。