server { listen 80; listen 443; #listen [::]:80; server_name junghh.com www.junghh.com; #替换成你的域名 if ($server_port = 80) { return 301 https://$server_name$request_uri; } if ($scheme = http) { return 301 https://$server_name$request_uri; } ssl on; ssl_certificate /usr/local/nginx/conf/1_www.junghh.com_bundle.crt; #替换文件名字 ssl_certificate_key /usr/local/nginx/conf/2_www.junghh.com.key; #替换文件名字 ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/junghh.com; #替换目录 后面的不管 }