<?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>服务器安全维护工作室 &#187; CentOS 6 配置 Nginx 80自动跳转至443端口</title>
	<atom:link href="https://www.fuwuqiok.com/tag/centos-6-%e9%85%8d%e7%bd%ae-nginx-80%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e8%87%b3443%e7%ab%af%e5%8f%a3/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fuwuqiok.com</link>
	<description></description>
	<lastBuildDate>Sun, 01 Mar 2020 07:28:40 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.26</generator>
	<item>
		<title>CentOS 6 配置 Nginx 80自动跳转至443端口</title>
		<link>https://www.fuwuqiok.com/centos-6-%e9%85%8d%e7%bd%ae-nginx-80%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e8%87%b3443%e7%ab%af%e5%8f%a3/</link>
		<comments>https://www.fuwuqiok.com/centos-6-%e9%85%8d%e7%bd%ae-nginx-80%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e8%87%b3443%e7%ab%af%e5%8f%a3/#comments</comments>
		<pubDate>Tue, 08 Dec 2015 14:43:53 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[网站代维]]></category>
		<category><![CDATA[CentOS 6 配置 Nginx 80自动跳转至443端口]]></category>

		<guid isPermaLink="false">https://www.fuwuqiok.com/?p=2814</guid>
		<description><![CDATA[<p>1、yum 安装 nginx 配置 yum 源： 在 /etc/yum.repos.d/ 新建文件 nginx [&#8230;]</p>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/centos-6-%e9%85%8d%e7%bd%ae-nginx-80%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e8%87%b3443%e7%ab%af%e5%8f%a3/">CentOS 6 配置 Nginx 80自动跳转至443端口</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></description>
				<content:encoded><![CDATA[<div class="entry-content">
<h3>1、yum 安装 nginx</h3>
<blockquote><p>配置 yum 源：<br />
在 /etc/yum.repos.d/ 新建文件 nginx.repo ，写入如下内容：</p>
<pre>[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=0
enabled=1
</pre>
<p>安装：</p>
<pre>yum install nginx -y</pre>
</blockquote>
<h3>2、配置 80 跳转 443（访问http协议时自动跳转到https协议）编辑 /etc/nginx/conf.d/default.conf 文件修改如下:</h3>
<blockquote><p>server {<br />
listen 80;<br />
server_name fuwuqiok.com;</p>
<p>rewrite ^(.*)$ https://$server_name$1 permanent;</p>
<p>access_log /var/log/nginx/host.http2https.access.log main;</p>
<p>}</p></blockquote>
<h3>3、https反向代理（https协议的访问实际是访问所代理的9800端口）</h3>
<blockquote><p>server {<br />
listen 443;<br />
server_name fuwuqiok.com;</p>
<p>ssl on;<br />
ssl_certificate /etc/pki/tls/certs/lee.crt;<br />
ssl_certificate_key /etc/pki/tls/certs/lee.key;</p>
<p>access_log /var/log/nginx/host.note.access.log main;</p>
<p>location / {</p>
<p>proxy_pass http://127.0.0.1:9800;</p>
<p>resolver_timeout 30s;<br />
proxy_set_header Host $http_host;<br />
proxy_set_header X-Real-IP $remote_addr;<br />
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />
proxy_set_header X-Forwarded-Proto https;<br />
proxy_redirect off;</p>
<p>}</p>
<p>}</p></blockquote>
</div>
<p><a rel="nofollow" href="https://www.fuwuqiok.com/centos-6-%e9%85%8d%e7%bd%ae-nginx-80%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e8%87%b3443%e7%ab%af%e5%8f%a3/">CentOS 6 配置 Nginx 80自动跳转至443端口</a>，首发于<a rel="nofollow" href="https://www.fuwuqiok.com">服务器安全维护工作室</a>。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fuwuqiok.com/centos-6-%e9%85%8d%e7%bd%ae-nginx-80%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e8%87%b3443%e7%ab%af%e5%8f%a3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
