阿里云免费购买SSL证书,nginx无缝升级https

阿里云免费购买SSL证书,nginx无缝升级https,第1张

概述最近在升级交流学习社区,觉得有必要升级成https.以下是自己在升级中记录。以下包括以下部分:一、阿里云免费购买SSL证书1、自己在阿里云申请了免费的,然后自己支付0元,购买了SSL证书2、我选择DNS验证3、在SSL证书中,下载cert证书,然后放到nginx服务器上二、nginx无缝升级https4、查看nginx是否支持ssl5、配置ssl模块6、重新编译一下7、因为这次是升级nginx,所以不需要执行 make install,首先备份原nginx执行脚本8、把新编译的nginx执行脚本拷贝到相应的目录下:’9、最后进行平滑升级10、再次检查nginx是否有https模块11、展示一下https网站站点,https://www.mwcxs.top/附注1:nginx配置SSL报错问题,ssl on报错附注2:nginx的https服务配置  1、自己在阿里云申请了免费的,然后自己支付0元,购买了SSL证书2、我选择DNS验证,因为域名是自己的。DNS验证方式一般需要由您的域名管理人员进行相关 *** 作。请按照您的证书订单中的进度提示,在您的域名管理系统中进行相应配置。选择DNS域名授权验证方式,您需要到您的域名解析服务商(如万网、新网、DNSPod等)提供的系统中进行配置。例如,您的域名托管在阿里云,则需要到云解析DNS控制台进行相关配置。 生成之后的域名验证,在域名解析管理可以看到。 3、在SSL证书中,下载cert证书,然后放到nginx服务器上4、查看nginx是否支持ssl:./nginx -V查看 configure arguments 信息中是否包含 -with-http_ssl_module 字样 5、配置ssl模块找到之前安装 Nginx 时的解压目录,配置ssl模块:./configure --with-http_ssl_module 6、重新编译一下在解压目录执行makemake  7、因为这次是升级nginx,所以不需要执行 make install,首先备份原nginx执行脚本:mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old  8、把新编译的nginx执行脚本拷贝到相应的目录下:cd objscp nginx /usr/local/nginx/sbin/ 9、最后进行平滑升级cd ..make upgrade  10、再次检查nginx是否有https模块  11、展示一下https网站站点,https://www.mwcxs.top/  附注1:nginx配置SSL报错问题,ssl on报错启动报错(错误信息:nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /home/soft/nginx/conf/nginx.conf:76)需要配置模块ssl模块 --with-http_ssl_modul,请查看本文的第二部分:2、配置ssl模块 附注2:nginx的https服务配置# HTTPS serverserver {listen 443;server_name www.mwcxs.top;ssl on;root /home/nodejs/liblog/www;index index.js index.html index.htm;ssl_certificate /usr/local/nginx/cert/15420110408020120565539868.crt;ssl_certificate_key /usr/local/nginx/cert/15420110408020120565539868.key;ssl_session_cache shared:SSL:1m;ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_prefer_server_ciphers on;if ( -f $request_filename/index.html ){rewrite (.*) $1/index.html break;}if ( !-f $request_filename ){rewrite (.*) /index.js;}location / {proxy_http_version 1.1;proxy_set_header Connection "";proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header Host $http_host;proxy_set_header X-NginX-Proxy true;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";proxy_pass http://learning_community_node$request_uri;proxy_redirect off;}location = /production.js {deny all;}location = /testing.js {deny all;}location ~ /static/ {etag on;expires max;}}server {listen 80;server_name www.mwcxs.top mwcxs.top;return 301 https://$server_name$request_uri;}注:return 301 https://$server_name$request_uri;用来把http转换成https。欢迎关注:https://github.com/saucxs/nodeJSBlog ,欢迎fork和start

最近在升级交流学习社区,觉得有必要升级成https.以下是自己在升级中记录。

以下包括以下部分:

一、阿里云免费购买SSL证书

1、自己在阿里云申请了免费的,然后自己支付0元,购买了SSL证书

2、我选择DNS验证

3、在SSL证书中,下载cert证书,然后放到Nginx服务器上

二、Nginx无缝升级https

4、查看Nginx是否支持ssl

5、配置ssl模块

6、重新编译一下

7、因为这次是升级Nginx,所以不需要执行 make install,首先备份原Nginx执行脚本

8、把新编译的Nginx执行脚本拷贝到相应的目录下:’

9、最后进行平滑升级

10、再次检查Nginx是否有https模块

11、展示一下https网站站点,

附注1:nginx配置SSL报错问题,ssl on报错

附注2:nginx的https服务配置

./nginx -V

查看 configure arguments 信息中是否包含 -with-http_ssl_module 字样

找到之前安装 Nginx 时的解压目录,配置ssl模块:

./configure ---http_ssl_module

在解压目录执行make

make

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

cd objscp nginx /usr/local/nginx/sbin/

 

启动报错(错误信息:Nginx: [emerg] the "ssl" parameter ngx_http_ssl_module /home/soft/Nginx/conf/Nginx.conf:

需要配置模块ssl模块 --with-http_ssl_modul,请查看本文的第二部分:2、配置ssl模块

server </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; <a href="https://m.jb51.cc/tag/List/" target="_blank" >List</a>en 443; server_<a href="https://m.jb51.cc/tag/name/" target="_blank" >name</a> www.mwcxs.<a href="https://m.jb51.cc/tag/top/" target="_blank" >top</a>; ssl on; root /home/node<a href="https://m.jb51.cc/tag/Js/" target="_blank" >Js</a>/<a href="https://m.jb51.cc/tag/li/" target="_blank" >li</a>blog/www; index index.<a href="https://m.jb51.cc/tag/Js/" target="_blank" >Js</a> index.<a href="https://m.jb51.cc/tag/HTML/" target="_blank" >HTML</a> index.<a href="https://m.jb51.cc/tag/htm/" target="_blank" >htm</a>; ssl_certificate /usr/local/<a href="https://www.jb51.cc/tag/Nginx/" target="_blank" >Nginx</a>/cert/15420110408020120565539868.crt; ssl_certificate_key /usr/local/<a href="https://www.jb51.cc/tag/Nginx/" target="_blank" >Nginx</a>/cert/15420110408020120565539868.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!N<a href="https://m.jb51.cc/tag/ul/" target="_blank" >ul</a>L:!aN<a href="https://m.jb51.cc/tag/ul/" target="_blank" >ul</a>L:!MD5:!ADH:!RC4; ssl_protoc<a href="https://m.jb51.cc/tag/ol/" target="_blank" >ol</a>s TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; if ( -f $request_<a href="https://m.jb51.cc/tag/file/" target="_blank" >file</a><a href="https://m.jb51.cc/tag/name/" target="_blank" >name</a>/index.<a href="https://m.jb51.cc/tag/HTML/" target="_blank" >HTML</a> ){ rewrite (.</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;*)</span> $<span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #800080;"&gt;1</span>/index.<a href="https://m.jb51.cc/tag/HTML/" target="_blank" >HTML</a> <span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #0000ff;"&gt;break</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #000000;"&gt;; } </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #0000ff;"&gt;if</span> ( !-f $request_<a href="https://m.jb51.cc/tag/file/" target="_blank" >file</a><a href="https://m.jb51.cc/tag/name/" target="_blank" >name</a> )<span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; rewrite (.</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;*)</span> /<span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #000000;"&gt;index.<a href="https://m.jb51.cc/tag/Js/" target="_blank" >Js</a>; } location </span>/ <span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; proxy_<a href="https://m.jb51.cc/tag/http/" target="_blank" >http</a>_version 1.1; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> Connection ""; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> X-Real-IP $remote_addr; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> Host $<a href="https://m.jb51.cc/tag/http/" target="_blank" >http</a>_host; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> X-<a href="https://www.jb51.cc/tag/Nginx/" target="_blank" >Nginx</a>-Proxy true; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> Upgrade $<a href="https://m.jb51.cc/tag/http/" target="_blank" >http</a>_upgrade; proxy_set_<a href="https://m.jb51.cc/tag/header/" target="_blank" >header</a> Connection "upgrade"; proxy_pass <a href="https://m.jb51.cc/tag/http/" target="_blank" >http</a>://learning_com<a href="https://www.jb51.cc/tag/munit/" target="_blank" >munit</a>y_node$request_uri; proxy_redirect off; </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;}</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #000000;"&gt; location </span>= /production.<a href="https://m.jb51.cc/tag/Js/" target="_blank" >Js</a> <span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; deny all; </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;}</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #000000;"&gt; location </span>= /testing.<a href="https://m.jb51.cc/tag/Js/" target="_blank" >Js</a> <span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; deny all; </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;}</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #000000;"&gt; location ~ </span>/static/ <span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; etag on; expires max; </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;}</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #000000;"&gt;}server </span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;{</span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt; <a href="https://m.jb51.cc/tag/List/" target="_blank" >List</a>en 80; server_<a href="https://m.jb51.cc/tag/name/" target="_blank" >name</a> www.mwcxs.<a href="https://m.jb51.cc/tag/top/" target="_blank" >top</a> mwcxs.<a href="https://m.jb51.cc/tag/top/" target="_blank" >top</a>; <span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #ff0000;"&gt;<strong>return <a href="https://www.jb51.cc/tag/301/" target="_blank" >301</a> <a href="https://m.jb51.cc/tag/http/" target="_blank" >http</a>s://$server_<a href="https://m.jb51.cc/tag/name/" target="_blank" >name</a>$request_uri;</strong></span></span><span https://m.jb51.cc/tag/color/" target="_blank" >color</a>: #008000;"&gt;}</span></pre>
注:return 301 https://$server_name$request_uri;用来把http转换成https。欢迎关注:href="https://github.com/saucxs/nodeJsBlog" target="_blank">https://github.com/saucxs/nodeJsBlog,欢迎fork和start
总结

以上是内存溢出为你收集整理的阿里云免费购买SSL证书,nginx无缝升级https全部内容,希望文章能够帮你解决阿里云免费购买SSL证书,nginx无缝升级https所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1050702.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存