<?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>nginx &#8211; acm&#039;s blog</title>
	<atom:link href="https://blog.acm.idv.tw/tag/nginx/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.acm.idv.tw</link>
	<description>技術與生活隨筆</description>
	<lastBuildDate>Wed, 01 May 2024 11:41:48 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>

<image>
	<url>https://blog.acm.idv.tw/wp-content/uploads/2022/06/cropped-logo_kaffa9-3-32x32.png</url>
	<title>nginx &#8211; acm&#039;s blog</title>
	<link>https://blog.acm.idv.tw</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>WordPress位於reverse proxy後的設定方式</title>
		<link>https://blog.acm.idv.tw/2024/05/01/wordpress%e4%bd%8d%e6%96%bcreverse-proxy%e5%be%8c%e7%9a%84%e8%a8%ad%e5%ae%9a%e6%96%b9%e5%bc%8f/</link>
					<comments>https://blog.acm.idv.tw/2024/05/01/wordpress%e4%bd%8d%e6%96%bcreverse-proxy%e5%be%8c%e7%9a%84%e8%a8%ad%e5%ae%9a%e6%96%b9%e5%bc%8f/#respond</comments>
		
		<dc:creator><![CDATA[kaffa9]]></dc:creator>
		<pubDate>Wed, 01 May 2024 11:41:48 +0000</pubDate>
				<category><![CDATA[系統維運]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://blog.kaffa9.com/?p=827</guid>

					<description><![CDATA[參考文章 https://medium.com/@tyh409700530/nginx-reverse-proxy-wordpress-in-https-mod...<p class="read-more"><a class="btn btn-default" href="https://blog.acm.idv.tw/2024/05/01/wordpress%e4%bd%8d%e6%96%bcreverse-proxy%e5%be%8c%e7%9a%84%e8%a8%ad%e5%ae%9a%e6%96%b9%e5%bc%8f/"> Read More<span class="screen-reader-text">  Read More</span></a></p>]]></description>
										<content:encoded><![CDATA[
<p>參考文章 <a href="https://medium.com/@tyh409700530/nginx-reverse-proxy-wordpress-in-https-mode-a21658f23978">https://medium.com/@tyh409700530/nginx-reverse-proxy-wordpress-in-https-mode-a21658f23978</a> ，使用 nginx，於 nginx 設定檔設定：</p>



<pre class="EnlighterJSRAW" data-enlighter-language="nginx" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># location 設定
location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_redirect off;
}</pre>



<p>確保wp-config.php加入以下原始碼，否則使用HTTPS連線時，有機會遇到redirect loop (HTTP 302)：</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">if (isset($_SERVER[‘HTTP_X_FORWARDED_HOST’])) {
    $_SERVER[‘HTTP_HOST’] = $_SERVER[‘HTTP_X_FORWARDED_HOST’];
}
if (isset($_SERVER[‘HTTP_X_FORWARDED_PROTO’])) {
    if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’) {
        $_SERVER[‘HTTPS’] = ‘on’;
    }
}</pre>



<p>官網提供的範例是：</p>



<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">if( strpos( $_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false )
    $_SERVER['HTTPS'] = 'on';</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.acm.idv.tw/2024/05/01/wordpress%e4%bd%8d%e6%96%bcreverse-proxy%e5%be%8c%e7%9a%84%e8%a8%ad%e5%ae%9a%e6%96%b9%e5%bc%8f/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
