<?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>Victor Hung%27s Diary</title>
	<atom:link href="https://taskinghouse.com/posts/tag/%E5%9B%BA%E5%AE%9A%E7%B6%B2%E5%9D%80/feed/" rel="self" type="application/rss+xml" />
	<link>https://taskinghouse.com</link>
	<description></description>
	<lastBuildDate>Wed, 12 Sep 2018 02:21:20 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://taskinghouse.com/wp-content/uploads/2018/05/cropped-favicon.png</url>
	<title>固定網址 &#8211; TaskingHouse</title>
	<link>https://taskinghouse.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>「教學」Plesk 調整 Nginx 解決 WordPress 固定網址 404 錯誤</title>
		<link>https://taskinghouse.com/posts/adjusts-nginx-settings-to-fix-wordpress-permalink-404-error-with-plesk/</link>
		
		<dc:creator><![CDATA[Victor Hung]]></dc:creator>
		<pubDate>Fri, 31 Aug 2018 16:00:18 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[index.php]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Permalink]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[固定網址]]></category>
		<guid isPermaLink="false">https://diary.taskinghouse.com/?p=2110</guid>

					<description><![CDATA[<p>Nginx 有低資源、低消耗、高效能等優點，但一般網路關於 WordPress 的架站教學、虛擬主機快速安裝 WordPress 的功能，通常都是預設使用 Ap...</p>
<p>這篇文章 <a rel="nofollow" href="https://taskinghouse.com/posts/adjusts-nginx-settings-to-fix-wordpress-permalink-404-error-with-plesk/">「教學」Plesk 調整 Nginx 解決 WordPress 固定網址 404 錯誤</a> 最早出現於 <a rel="nofollow" href="https://taskinghouse.com">TaskingHouse</a>。</p>
]]></description>
										<content:encoded><![CDATA[<p>Nginx 有低資源、低消耗、高效能等優點，但一般網路關於 WordPress 的架站教學、虛擬主機快速安裝 WordPress 的功能，通常都是預設使用 Apache。如果主機使用 Plesk 這樣的管理軟體，可以很輕鬆的透過 GUI 介面設定 PHP 版本，以及選擇使用 Nginx 或是 Apache 來作為負載均衡器。</p>
<p>本篇會使用到 Plesk 兩個設定頁面，首先點選 PHP 設定：</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-2111" src="https://taskinghouse.com/wp-content/uploads/2018/08/nginx-wordpress-404-menu.png" alt="" width="2048" height="1106" /></p>
<p>在 PHP 支援中選擇 PHP 版本以集運行 PHP 以 <code>FPM 應用程式 由 nginx 服務</code></p>
<p>此外有些主題或外掛會要求「PHP Max Input Vars」的數值，也可以在這個頁面的最下方設定，例如 Avada 主題建議的 5000 則是 <code>max_input_vars = 5000</code></p>
<p><img decoding="async" class="alignnone size-medium wp-image-2113" src="https://taskinghouse.com/wp-content/uploads/2018/08/nginx-wordpress-404-php.png" alt="" width="2048" height="1106" /></p>
<p>如果你的 WordPress 固定網址設定是使用「一般」或「數值式」那沒問題，但如果你是使用「文章名稱」或其他自訂結構，在你改為使用 Nginx 之後，Plesk 應該會將設定改為自訂結構並加入 <code>index.php</code> 字串在網址前面。</p>
<p>你可能跟筆者一樣覺得網址裡面顯示 <code>index.php</code> 實在是很醜，但如果你手動改回文章名稱，首頁沒問題，但其他頁面就會直接 404 找不到頁面，這就是因為 Nginx 的 Rewrite 功能沒有設定好所造成的錯誤，截止目前為止 WordPress 似乎都沒有辦法自動修正這個問題，而 Plesk 則是直接修改網址結構，有種便宜行事的感覺。</p>
<p><img decoding="async" class="alignnone size-full wp-image-2114" src="https://taskinghouse.com/wp-content/uploads/2018/08/nginx-wordpress-404-permalink.png" alt="" width="2048" height="1024" /></p>
<p>因此我們回到第一張圖的「Apache 與 nginx 設定」在最下方的「其他 Nginx 指令」輸入以下內容：</p>
<p><img loading="lazy" decoding="async" class="alignnone size-medium wp-image-2112" src="https://taskinghouse.com/wp-content/uploads/2018/08/nginx-wordpress-404-nginx.png" alt="" width="2048" height="1106" /></p>
<p><code>if (!-e $request_filename) {</code><br />
<code>	set $test P;</code><br />
<code>}</code><br />
<code>if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {</code><br />
<code>	set $test "${test}C";</code><br />
<code>}</code><br />
<code>if ($test = PC) {</code><br />
<code>	rewrite ^/(.*)$ /index.php?$1;</code><br />
<code>}</code></p>
<p>以上就能解決使用 Nginx 在 WordPress 固定網址所造成的 404 錯誤。</p>
<p>這篇文章 <a rel="nofollow" href="https://taskinghouse.com/posts/adjusts-nginx-settings-to-fix-wordpress-permalink-404-error-with-plesk/">「教學」Plesk 調整 Nginx 解決 WordPress 固定網址 404 錯誤</a> 最早出現於 <a rel="nofollow" href="https://taskinghouse.com">TaskingHouse</a>。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
