<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>https &#8211; 萧邦的博客</title>
	<atom:link href="https://www.zlhlab.top/tag/https/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.zlhlab.top</link>
	<description>If not me who, If not now when</description>
	<lastBuildDate>Thu, 29 Jun 2017 07:28:47 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.6</generator>
	<item>
		<title>阿里云centos7搭建HTTPS</title>
		<link>https://www.zlhlab.top/%e9%98%bf%e9%87%8c%e4%ba%91centos7%e6%90%ad%e5%bb%bahttps/</link>
		
		<dc:creator><![CDATA[萧邦]]></dc:creator>
		<pubDate>Thu, 29 Jun 2017 07:00:15 +0000</pubDate>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[https]]></category>
		<guid isPermaLink="false">https://www.zlhlab.top/?p=126</guid>

					<description><![CDATA[目前苹果和微信小程序的接口，都建议或要求https进行数据传输。利用项目空档期，来学习研究一下HTTPS 1、<div class="more-link">
				 <a href="https://www.zlhlab.top/%e9%98%bf%e9%87%8c%e4%ba%91centos7%e6%90%ad%e5%bb%bahttps/" class="link-btn theme-btn"><span>Read More </span> <i class="fa fa-caret-right"></i></a>
			</div>]]></description>
										<content:encoded><![CDATA[<p>目前苹果和微信小程序的接口，都建议或要求https进行数据传输。利用项目空档期，来学习研究一下HTTPS</p>
<p><strong>1、服务器环境要求</strong></p>
<p>服务器配置<code> centos7 + LNMP环境 + ssl</code>，购买域名，完成域名备案和服务器绑定。</p>
<p><strong>2、购买云盾证书</strong></p>
<p>证书品牌商有赛门铁克、GeoTrust等，商业用途可以对比和选择一下。证书有分专业型、免费型的，专业型主要针对企业用户。</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-large wp-image-128" src="https://www.zlhlab.top/wp-content/uploads/2017/06/9C62A584-CDDA-4CD8-B16B-CE8EF568F102-1024x567.png" alt="云盾证书购买" width="1024" height="567" srcset="https://www.zlhlab.top/wp-content/uploads/2017/06/9C62A584-CDDA-4CD8-B16B-CE8EF568F102-1024x567.png 1024w, https://www.zlhlab.top/wp-content/uploads/2017/06/9C62A584-CDDA-4CD8-B16B-CE8EF568F102-300x166.png 300w, https://www.zlhlab.top/wp-content/uploads/2017/06/9C62A584-CDDA-4CD8-B16B-CE8EF568F102-768x425.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<p>我选择的个人DV型，输入简单个人信息即可，0元购买&#8211;&gt;进行域名绑定，勾选生成TXT标签记录值&#8211;&gt;等待证书自动签发，时间1天以内。</p>
<p><img decoding="async" class="aligncenter size-large wp-image-129" src="https://www.zlhlab.top/wp-content/uploads/2017/06/98A32F9C-66D3-4F0E-9914-D916F48838B4-1024x91.png" alt="" width="1024" height="91" srcset="https://www.zlhlab.top/wp-content/uploads/2017/06/98A32F9C-66D3-4F0E-9914-D916F48838B4-1024x91.png 1024w, https://www.zlhlab.top/wp-content/uploads/2017/06/98A32F9C-66D3-4F0E-9914-D916F48838B4-300x27.png 300w, https://www.zlhlab.top/wp-content/uploads/2017/06/98A32F9C-66D3-4F0E-9914-D916F48838B4-768x68.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<p><strong>3、上传证书</strong></p>
<p>服务器端创建目录，上传 ***.key 和 ***.pem文件至创建目录</p>
<pre><code>mkdir /etc/nginx/cert</code></pre>
<p><strong>4、修改nginx配置</strong></p>
<p>实现http和https都可以访问站点，修改配置文件如下：</p>
<pre><code>
    server {
        listen       80;
        listen       443 ssl;
#        listen       [::]:443 ssl http2 default_server;
        server_name  api.geek720.com;
        root         /var/www/api/;
#
        ssl_certificate "/etc/nginx/cert/214179396460449.pem";
        ssl_certificate_key "/etc/nginx/cert/214179396460449.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
        location / {
            index index.php index.html index.htm;
        }
#
        error_page 404 /404.html;
            location = /40x.html {
        }
#
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

        location ~ \.php {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index /index.php;

            include /etc/nginx/fastcgi_params;

            fastcgi_split_path_info     ^(.+\.php)(/.+)$;
            fastcgi_param PATH_INFO     $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED       $document_root$fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME       $document_root$fastcgi_script_name;
        }
        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
            root $root_path;
        }
        location ~/\.ht {
            deny all;
        }
    }

</code></pre>
<p><strong>5、重启nginx服务，并测试配置结果</strong></p>
<p>修改nginx配置文件保存退出，重启nginx服务&lt;/&gt;</p>
<pre><code>service nginx restart</code></pre>
<p>&nbsp;</p>
<p>打开地址栏，输入 https:api.geek720.com, 展示结果如下，即https配置完成。</p>
<p><img decoding="async" class="aligncenter size-large wp-image-136" src="https://www.zlhlab.top/wp-content/uploads/2017/06/84BCA211-DB86-419C-A1A3-0DB2B4F863F6-1024x175.png" alt="" width="1024" height="175" srcset="https://www.zlhlab.top/wp-content/uploads/2017/06/84BCA211-DB86-419C-A1A3-0DB2B4F863F6-1024x175.png 1024w, https://www.zlhlab.top/wp-content/uploads/2017/06/84BCA211-DB86-419C-A1A3-0DB2B4F863F6-300x51.png 300w, https://www.zlhlab.top/wp-content/uploads/2017/06/84BCA211-DB86-419C-A1A3-0DB2B4F863F6-768x131.png 768w, https://www.zlhlab.top/wp-content/uploads/2017/06/84BCA211-DB86-419C-A1A3-0DB2B4F863F6.png 2026w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
