通王的官网www.tongwang.cn用的就是https, 做好服务器上网站配置文件的修改就行了,现在很多服务器的一键安装包都支持的,lnmp ,宝塔都可以,lnmp的话需要修改网站的nginx配置文件,把你的ssl证书放到对应的位置就可以了。
server
{
listen 80;
#listen [::]:80;
server_name xxxx.cn www.xxxx.cn;
index index.html index.htm index.php default.html default.htm default.php;
root /www/wwwroot/xxxx.cn;
return 301 https://www.xxxx.cn$request_uri;
include rewrite/tw.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name xxxx.cn www.xxxx.cn;
index index.html index.htm index.php default.html default.htm default.php;
root /www/wwwroot/xxxx.cn;
ssl_certificate /usr/local/nginx/conf/ssl/ssl文件名.pem;
ssl_certificate_key /usr/local/nginx/conf/ssl/ssl文件名.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
include rewrite/tw.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
也可以在新建网站的时候直接开通ssl,调用自己的ssl证书文件,记得要把你的ssl证书文件传到:
/usr/local/nginx/conf/ssl/ 这个目录下面,或者你自己定义的目录下面。
然后重启nginx就可以了,这样既做好了ssl,也做好了由http://跳转到https://的步骤。
如果你的服务器使用的宝塔面板,那更好操作了,直接在宝塔里面网站列表点击对应网站后面的设置,切换到ssl,申请证书,申请好部署完成后,强制https打开就可以了,非常简单。