2013-01-04 91 views
0

背景:在我的Ubuntu服務器上運行的nginx轉換阿帕奇重寫規則(.htaccess)是否nginx的

我想設置Bugify。我按照說明安裝了依賴關係,安裝成功。一旦我輸入我的許可證密鑰並單擊「安裝Bugify」,它將重定向到http://dev.mysite.com/login?new,我看到的唯一的東西是404 Not Found

我知道nginx沒有正式支持,但根據support forum應該可以運行它。

問:

有一個.htaccess文件與web應用程序的公共目錄重寫規則,我想導致404錯誤的問題是,nginx的是無法與.htaccess文件的工作,所以我必須將重寫規則轉換爲nginx語法。

我不是很熟悉Apache的重寫規則,所以我需要一些幫助來解決這個問題。

.htaccess文件的內容是:

# Rewriting 
RewriteEngine On 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

我用this tool轉換的規則,但它有一些麻煩與-標誌。

#ignored: "-" thing used or unknown variable in regex/rew 

在此先感謝!

+0

破折號將轉換器「忽略」複製下面的建議nginx的配置是指不重寫匹配要求的人。 – qsheets

回答

1

Bugify使用Zend Framework,因此ZF的重寫規則也應該適用於Bugify。我從http://wiki.nginx.org/Zend_Framework

server { 
    listen 80; 
    server_name www.example.com; 
    root /var/www/www.example.com/myapplication; 
    index index.html index.htm index.php; 

    location/{ 
    # This is cool because no php is touched for static content 
    try_files $uri $uri/ /index.php; 
    } 

    location ~ \.php$ { 
    fastcgi_pass  unix:/usr/local/zend/tmp/php-fastcgi.socket; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME /var/www/www.example.com/myapplication$fastcgi_script_name; 
    include    fastcgi_params; 
    } 
} 
+0

我正在使用完全相同的nginx配置,除了沒有 'try_files $ uri $ uri//index.php;' 部分。我添加了它,現在一切正常。感謝您的支持,即使nginx沒有正式支持。我想你可以將它添加到支持的網絡服務器列表,如果你將這個片段添加到bugify知識庫! – mediocre