主要参考

/usr/local/nginx/sbin/nginx 1.8.1 没有启用SSL /sbin/nginx 1.21.0 启用SSL, 修改/etc/nginx/下的配置

/usr/sbin/nginx -c /etc/nginx/conf/nginx.conf

Config:

server {

listen 80;

rewrite (.*) https://$host$1 permanent;

#return 301 https://$host$request_uri;

}

server {

server_name dev.test.com;

listen 443;

ssl on;

ssl_certificate /home/tls/test.crt;

ssl_certificate_key /home/tls/test.key;

location / {

proxy_pass http://127.0.0.1:7001;

}

}