nginx安裝阿里雲https服務
阿新 • • 發佈:2019-01-08
本次主要是介紹下,安裝阿里雲免費型dv ssl證書服務型別(品牌 SYmantec)
1、購買免費證書,目前免費的只有Symantec了
2、補全資訊
將自己的域名和個人資訊等按照要求補全即可
3、驗證許可權
按照要求進行即可 這裡不在多說
4、伺服器上配置HTTPS證書
下載你操作完成的證書到你伺服器,我是放在了/website/目錄下。然後配置你的nginx配置檔案
配置完成後重啟nginxserver { listen 80; listen 443; #listen [::]:80; server_name 你的域名; ssl on; index index.html index.htm index.php default.html default.htm default.php; root /website/xiaocheng; ssl_certificate /website/214220405930072.pem; ssl_certificate_key /website/214220405930072.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; include other.conf; #error_page 404 /404.html; include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /\. { deny all; } access_log /home/wwwlogs/xiaocheng.xuezhangbang.me.log; }
5、配置開啟伺服器443埠
修改/etc/sysconfig/iptables 檔案在它尾部(COMMIT上)新增一行 -A INPUT -p tcp --dport 443 -j ACCEPT 然後重啟iptablesservice iptables restart
netstat
-an |grep 443 看下 如果有類似說明開啟443埠成功了 netstat -an |grep 443
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
6、檢測伺服器是否安裝ssl相關模組擴充套件
用 nginx -V 命令檢查一下。如果沒有ssl模組則需要重新安裝(建議升級到最新版本)如果存在--with-http_ssl_module說明有 另外,nginx需要依賴 openssl 提供ssl支援,這個也要有
沒有的話自行百度安裝哦
7、在阿里雲控制檯新增SLB 443埠監聽轉發
點選確定即可,然後去試試你的域名利用https訪問吧