编译安装时加一个参数就好

./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make

nginx.conf
server {
listen 443 ssl;
server_name 68.168.128.247;
ssl_certificate /etc/letsencrypt/live/www.dubo.world/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.dubo.world/privkey.pem;
ssl_dhparam /etc/ssl/certs/dhparams.pem;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
}
server {
listen 80;
server_name www.dubo.world;
return 301 https://servernameserver_nameservern​amerequest_uri; //http重定向到https
}

更多推荐