這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
linux:web:nginx_wordpress [2014/06/12 02:33] ali88 [Nginx Rewrite rule設定] |
linux:web:nginx_wordpress [2014/06/12 02:40] (目前版本) ali88 |
||
---|---|---|---|
行 7: | 行 7: | ||
- 接下來需要搭配Nginx rewrite方式才能達到wordpress固定網址。 | - 接下來需要搭配Nginx rewrite方式才能達到wordpress固定網址。 | ||
- 若不採用Nginx rewrite作法就會產生以下錯誤。{{:linux:web:no_nginx_error_wordpress.png|}} | - 若不採用Nginx rewrite作法就會產生以下錯誤。{{:linux:web:no_nginx_error_wordpress.png|}} | ||
- | - Nginx Rewrite 設定<code> | + | - Nginx Rewrite 設定,當client端 $request_filename 不存在,就將全部檔案導到 wordpress 根目錄下的 index.php<code> |
server { | server { | ||
listen 80; | listen 80; | ||
行 17: | 行 17: | ||
- | # error_page 404 /index.php; | + | |
- | # if (!-e $request_filename) | + | if (!-e $request_filename) |
- | # { | + | { |
- | # rewrite ^(.+)$ /index.php?q=$1 last; | + | rewrite ^(.+)$ /index.php?q=$1 last; |
- | # } | + | } |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 |