關于https:
以HTTP1.1協(xié)議來說 使用HTTPS會影響速度,在HTTP2.0協(xié)議下就不會這樣了
HTTP自動跳轉(zhuǎn)HTTPS時POST方法會被轉(zhuǎn)成GET 參數(shù)會丟失。
首先購買一個與你的域名綁定的證書, 拿到了.pem跟.key文件
然后配置在nginx中
listen ? ? ?443;
ssl ? ?on;
ssl_certificate ? ?/etc/ssl/PROJECT_NAME/xxx.pem; #(or bundle.crt)
ssl_certificate_key ? ?/etc/ssl/PROJECT_NAME/xxx.key;
通過域名訪問 就可以了
然后把http設置為自動跳轉(zhuǎn)https
server {
listen ? ? ? ? 80;
server_name ? ?yourdomain.com;
return ? ? ? ? 301 https://$server_name$request_uri;
}
server {
listen ? ? ?443;
ssl ? ?on;
ssl_certificate ? ?/etc/ssl/yourprojectname/xxx.pem; #(or bundle.crt)
ssl_certificate_key ? ?/etc/ssl/yourprojectname/xxx.key;