http转https
server {
listen 80;
server_name ;
#root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx//*.conf;
if ($request_method = POST) {
# post请求应用307转发,这样不会丢失body
return 307 https://$host$request_uri;
}
# get请求用301、302都可以
return 301 https://$host$request_uri;
}