2012-07-20 117 views
1

我是網絡編程的新手。我想將Apache切換到Nginx Web服務器,但在Nginx模式重寫時仍然存在問題。將mod_rewrite Apache轉換爲Nginx嗎?

/home/user/public_html/read/我的網站定位和/home/user/public_html/read/.htaccess這樣我以前.htaccess文件:

Options +FollowSymlinks 

RewriteEngine on 

RewriteRule ^mangas/([^/]+)/([^/]+)/$ - [F,L] 
RewriteRule ^mangas/([^/]+)/$ - [F,L] 
RewriteRule ^mangas(/?)$ - [F,L] 

RewriteRule ^([^/.]+)/([^/.]+)/([0-9]+)(/?)$ index.php?manga=$1&chapter=$2&page=$3 [L] 
RewriteRule ^([^/.]+)/([^/.]+)(/?)$ index.php?manga=$1&chapter=$2 [L] 
RewriteRule ^([^/.]+)(/?)$ index.php?manga=$1 [L] 

我怎麼能轉換這個mod_rewrite的nginx的? (我soory,因爲我的英語拼寫是不完美的)

回答

1

server{}嘗試這些:

location ~ ^/mangas/([^/]+)/([^/]+)/$ { 
    return 403; 
} 
location ~ ^/mangas/([^/]+)/$ { 
    return 403; 
} 
location ~ ^/mangas(/?)$ { 
    return 403; 
} 

location/{ 
    rewrite ^/([^/.]+)/([^/.]+)/([0-9]+)(/?)$ /index.php?manga=$1&chapter=$2&page=$3 break; 
    rewrite ^/([^/.]+)/([^/.]+)(/?)$ /index.php?manga=$1&chapter=$2 break; 
    rewrite ^/([^/.]+)(/?)$ /index.php?manga=$1 break; 
} 
+0

還是不行:( 當我嘗試訪問我的網站,看起來像下載東西「應用流」。誰能幫助我與其他參考? – 2012-07-20 05:21:45

+0

@FikriOnline 什麼應用服務器你使用PHP?PHP-FPM ?你是如何配置nginx與它互動的? – VBart 2012-07-20 16:13:26

0

Ø協奏曲詩里亞:

location ~ ^/mangas/([^/]+)/([^/]+)/$ { 
    return 403; 
} 

location ~ ^/mangas/([^/]+)/$ { 
    return 403; 
} 
location ~ ^/mangas(/?)$ { 
    return 403; 
} 
location/{ 
    rewrite ^/([^/.]+)/([^/.]+)/([0-9]+)(/?)$ /index.php?manga=$1&chapter=$2&page=$3 last; 
    rewrite ^/([^/.]+)/([^/.]+)(/?)$ /index.php?manga=$1&chapter=$2 last; 
    rewrite ^/([^/.]+)(/?)$ /index.php?manga=$1 last; 
} 

NAO SEIporquê,MAS,alterando日破發最後一個funciona。

+1

你會介意翻譯成英語嗎(如果可能的話)。不是討厭的或任何東西 - 但這個網站是一個英文網站,以獲得最廣泛的覆蓋面。作爲首發。 – 2013-02-08 15:44:16

相關問題