申請的ssl證書的網址:https://www.pianyissl.com/
由於是測試,所以選擇免費的可試用
申請後會有個壓縮包
裏面有個nginx文件夾,把下面的
server.key
server.pem
這兩個文件上傳到服務器上。
在這個我把這兩個文件移動到/usr/local/nginx/conf 目錄下
server 端編譯nginx時需要加參數
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
make && make install
關於nginx配置https配置,追加以下內容
# HTTPS server
server {
listen 443;
server_name apk.moootooo.com;
ssl on;
ssl_certificate server.pem;
ssl_certificate_key server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}