1.先去騰訊雲上申請證書 可以申請一個免費證書
https://console.cloud.tencent.com/ssl/detail
進入到nginx下
cd nginx-1.12.2/
下面這一步的目的是爲了添加ssl http_ssl_module 和fastdfs-nginx-module 的第三方module 完成ssl的配置
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --add-module=/home/hanzl/fastdfs-nginx-module-master/src
進入到 cd /usr/local/nginx/conf
2.進入到conf 文件夾下配置
nginx.conf 特別注意 以下兩個配置就是在騰訊雲上申請的證書
下載下來 文件夾下的Nginx
特別注意
ssl_certificate 1_www.fitfree.wang_bundle.crt;
ssl_certificate_key 2_www.fitfree.wang.key;
將文件上傳到 /usr/local/nginx/conf 文件夾下里
listen 80;
listen 443 ssl;
server_name 你的域名;
ssl_certificate 你的.crt;
ssl_certificate_key 你的.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location ~/group([0-9])/M00 {
root /home/hanzl/fastdfs/data;
ngx_fastdfs_module;
}
測試: