2014-07-03 131 views
0

我有一個php symfony項目,我將apache作爲服務器去除,並且出於性能原因使用nginx。 沒有在我的virtualhost.conf我有以下設置將重寫規則apache轉換爲nginx

<Directory "/usr/share/myvirtualhost/web"> 
    Require all granted 
    Options -Indexes +FollowSymLinks 
    AllowOverride None 
    Allow from All 
    <IfModule mod_rewrite.c> 
     RewriteEngine On 

     RewriteCond %{HTTP:X-DEVELOP-DOC-TEST} ^running$ 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteRule ^(.*)$ app_doctest.php [QSA,L] 

     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteRule ^(.*)$ app.php [QSA,L] 
    </IfModule> 
</Directory> 

現在我不知道如何將它與

RewriteCond %{HTTP:X-DEVELOP-DOC-TEST} ^running$ 

我在哪裏檢查,如果轉換爲正確的nginx重寫規則,尤其是部分正在設置標題,將請求轉發到app_doctest.php

我該如何才能從這裏獲得更多?

回答

1

因此,這裏有一些鏈接在正確的方向搜索。

從那開始:a full doc on how to convert things from apache in the right way

而這意味着,例如,您不會使用重寫,而是使用try_files

然後對於特定的標題測試,您可以使用http_表單,您的X-DEVELOP-DOC-TEST標題應該在http_x_develop_doc_test變量中。避免if結構和更喜歡map或這樣的。