How to add SSL to your website?

2019-06-0219:58:12 评论

From the LNMP V1.5, we can add SSL via its new feature, let's do it as below:

Note: In Xshell/Centos, case your website is running well with http.

Step 1:

lnmp  ssl add

Step 2: enter your domain name such as "example.com"

Step 3: enter further more domain name such as "www.example.com"

Step 4: enter the path of your website such as "/home/wwwroot/example.com"

Step 5: enter "y" to enable the rewrite function and input the detailed rewrite rule such as "wordpress" 、"typecho" 、"discuz" and so on

Step 6: choose "y" or "no" to enable or disable the "phpinfo" and "log"

Step 7: enter 2 to use the let's encrypt SSL for free

After a minute, you will see the green words on the screen told you the SSL is ok.

Step 8: login to the wp-admin page of your website, replace the "http" with "https" in "settings"- "general"-"wordpress address" and "site address".

Step 9: in Xftp,find the "example.com.conf" in /usr/local/nginx/conf/vhost", download it and make a copy.

Step 10: open the "example.com.conf" and add the below sentence

if ($ssl_protocol = "") { return 301 https://$host$request_uri; }

below the

"#error_page 404 /404.html;"

save and upload this file to its orignal place with a replacement.

Step 11: in Xshell, do as below:

cd /usr/local/nginx/sbin
./nginx -s reload

Now, your website can works with https (SSL) well.

 

  • A+
所属分类:WP
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: