<?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>Mingshi &#187; https</title>
	<atom:link href="http://www.mingshi.info/tag/https/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mingshi.info</link>
	<description>miaomiao</description>
	<lastBuildDate>Fri, 18 Jun 2010 13:49:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>nginx主机配置ssl</title>
		<link>http://www.mingshi.info/nginx-ssl/</link>
		<comments>http://www.mingshi.info/nginx-ssl/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 14:20:53 +0000</pubDate>
		<dc:creator>Stanley</dc:creator>
				<category><![CDATA[网站技术]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.mingshi.info/?p=738</guid>
		<description><![CDATA[1、可以通过浏览器认证的ssl证书 openssl req -new -newkey rsa:2048 -nodes -out server.csr -keyout server.key 在当前目录下会发现server.csr server.key两个文件。 然后提供这两个文件，购买或者向startssl申请免费server.crt证书。 三个文件放在指定目录，如/root下 nginx配置文件例子如下： server { listen 443; server_name mydomain.com; index index.html index.htm index.php; root /web/www/test; ssl on; ssl_certificate /root/server.crt; ssl_certificate_key /root/server.key; } 重新启动nginx /usr/local/nginx/sbin/nginx -t kill -HUP `cat /usr/local/nginx/nginx.pid` startssl的证书需要添加根证书才可以被firefox信任，需要在配置conf文件前，添加根证书信息到server.crt wget http://www.startssl.com/certs/ca.pem wget http://www.startssl.com/certs/sub.class1.server.ca.pem cat ca.pem sub.class1.server.ca.pem >> server.crt 2、自制证书 openssl genrsa [...]]]></description>
			<content:encoded><![CDATA[<p>1、可以通过浏览器认证的ssl证书<br />
openssl req -new -newkey rsa:2048 -nodes -out server.csr -keyout server.key</p>
<p>在当前目录下会发现server.csr    server.key两个文件。</p>
<p>然后提供这两个文件，购买或者向startssl申请免费server.crt证书。</p>
<p>三个文件放在指定目录，如/root下</p>
<p>nginx配置文件例子如下：</p>
<p>server<br />
{<br />
listen       443;<br />
server_name  mydomain.com;<br />
index index.html index.htm index.php;<br />
root  /web/www/test;<br />
ssl on;<br />
ssl_certificate  /root/server.crt;<br />
ssl_certificate_key /root/server.key;<br />
}</p>
<p>重新启动nginx</p>
<p>/usr/local/nginx/sbin/nginx -t<br />
kill -HUP `cat /usr/local/nginx/nginx.pid`</p>
<p>startssl的证书需要添加根证书才可以被firefox信任，需要在配置conf文件前，添加根证书信息到server.crt</p>
<p>wget http://www.startssl.com/certs/ca.pem<br />
wget http://www.startssl.com/certs/sub.class1.server.ca.pem<br />
cat ca.pem sub.class1.server.ca.pem >> server.crt</p>
<p>2、自制证书</p>
<p>openssl genrsa -out server.key 2048<br />
openssl req -new -x509 -key privkey.key -out server.crt -days 1095</p>
<p>nginx的配置同上。</p>
<p>3、强制使用https访问的nginx的conf配置</p>
<p>server<br />
{<br />
listen      443;<br />
listen 80;<br />
server_name servername;<br />
index index.html index.htm index.php;<br />
root  /web/test;<br />
ssl on;<br />
ssl_certificate /root/server.crt;<br />
ssl_certificate_key /root/server.key;<br />
error_page 497 &#8220;https://$host$uri?$args&#8221;;<br />
}</p>
<p>或者<br />
error_page 497 &#8220;https://$host$uri$is_args$args&#8221;;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mingshi.info/nginx-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>asp/php实现在http和https之间跳转</title>
		<link>http://www.mingshi.info/aspphp%e5%ae%9e%e7%8e%b0%e5%9c%a8http%e5%92%8chttps%e4%b9%8b%e9%97%b4%e8%b7%b3%e8%bd%ac/</link>
		<comments>http://www.mingshi.info/aspphp%e5%ae%9e%e7%8e%b0%e5%9c%a8http%e5%92%8chttps%e4%b9%8b%e9%97%b4%e8%b7%b3%e8%bd%ac/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 09:47:18 +0000</pubDate>
		<dc:creator>Stanley</dc:creator>
				<category><![CDATA[网站技术]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.mingshi.info/?p=363</guid>
		<description><![CDATA[ASP： 以https开始，请在该ASP页面顶部添加如下代码： &#60;% Response.Buffer = True If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;off&#8221;) Then Dim xredir__, xqstr__ xredir__ = &#8220;https://&#8221; &#38; Request.ServerVariables(&#8220;SERVER_NAME&#8221;) &#38; _ Request.ServerVariables(&#8220;SCRIPT_NAME&#8221;) xqstr__ = Request.ServerVariables(&#8220;QUERY_STRING&#8221;) if xqstr__ &#60;&#62; &#8220;&#8221; Then xredir__ = xredir__ &#38; &#8220;?&#8221; &#38; xqstr__ Response.redirect xredir__ End if %&#62; 相反的，强迫以Http开始 &#60;% Response.Buffer = True If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;on&#8221;) Then Dim xredir__, xqstr__ [...]]]></description>
			<content:encoded><![CDATA[<p>ASP：<br />
以https开始，请在该ASP页面顶部添加如下代码：<br />
&lt;%<br />
Response.Buffer = True<br />
If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;off&#8221;) Then<br />
Dim xredir__, xqstr__<br />
xredir__ = &#8220;https://&#8221; &amp; Request.ServerVariables(&#8220;SERVER_NAME&#8221;) &amp; _<br />
Request.ServerVariables(&#8220;SCRIPT_NAME&#8221;)<br />
xqstr__ = Request.ServerVariables(&#8220;QUERY_STRING&#8221;)<br />
if xqstr__ &lt;&gt; &#8220;&#8221; Then xredir__ = xredir__ &amp; &#8220;?&#8221; &amp; xqstr__<br />
Response.redirect xredir__<br />
End if<br />
%&gt;<br />
相反的，强迫以Http开始<br />
&lt;%<br />
Response.Buffer = True<br />
If (Request.ServerVariables(&#8220;HTTPS&#8221;) = &#8220;on&#8221;) Then<br />
Dim xredir__, xqstr__<br />
xredir__ = &#8220;http://&#8221; &amp; Request.ServerVariables(&#8220;SERVER_NAME&#8221;) &amp; _<br />
Request.ServerVariables(&#8220;SCRIPT_NAME&#8221;)<br />
xqstr__ = Request.ServerVariables(&#8220;QUERY_STRING&#8221;)<br />
if xqstr__ &lt;&gt; &#8220;&#8221; Then xredir__ = xredir__ &amp; &#8220;?&#8221; &amp; xqstr__<br />
Response.redirect xredir__<br />
End if<br />
%&gt;</p>
<p>PHP：<br />
如果网页使用https访问，在网页开头加入以下代码：</p>
<p>&lt;?php</p>
<p>//http转化为https</p>
<p>if ($_SERVER["HTTPS"]&lt;&gt;&#8221;on&#8221;)</p>
<p>{   $xredir=&#8221;https://&#8221;.$_SERVER["SERVER_NAME"].</p>
<p>$_SERVER["REQUEST_URI"];   header(&#8220;Location: &#8220;.$xredir);</p>
<p>}</p>
<p>?&gt;</p>
<p>如果网页使用http访问，在网页开头加入以下代码：</p>
<p>&lt;?php</p>
<p>//https转化为http</p>
<p>if ($_SERVER["HTTPS"]==&#8221;on&#8221;)</p>
<p>{   $xredir=&#8221;http://&#8221;.$_SERVER["SERVER_NAME"].</p>
<p>$_SERVER["REQUEST_URI"];   header(&#8220;Location: &#8220;.$xredir);</p>
<p>}</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mingshi.info/aspphp%e5%ae%9e%e7%8e%b0%e5%9c%a8http%e5%92%8chttps%e4%b9%8b%e9%97%b4%e8%b7%b3%e8%bd%ac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
