2014-05-12 25 views
0

我試圖在運行Nginx的Ubuntu 14.04上部署Siremis 4.1(http://siremis.asipto.com/2014/03/25/siremis-v4-1-0-released/)。有關在網絡上運行Nginx上的Siremis的信息很少。我已經正確安裝了所有東西(我認爲),但是我對Nginx配置存在問題,無法正常提供頁面。在Nginx上運行Siremis web:

我幾乎可以確定問題出在URL重寫。我可以去這個網頁沒有問題:

DOMAIN/siremis/index.php文件/用戶/註冊

但我得到頁後,與此找不到網址:

DOMAIN/siremis /系統/ general_default

這讓我想起的WordPress的永久鏈接,這是我能得到與感謝他們出色的文件非常小問題的工作:http://codex.wordpress.org/Nginx

但是,Siremis是另一回事。我不確定Siremis是否不支持與Nginx合作,因爲它期望Apache在執行重定向或執行重定向時。只是想知道有沒有人有任何建議。顯然,我對Nginx很陌生。或者如果有人知道如何關閉Siremis中的重定向,那也可以!我不需要擁有「漂亮」的網址。

這裏是我的服務器配置:

server { 
     listen 80; 
     listen [::]:80; 

     charset utf-8; 
     access_log /var/log/nginx/siremis.access.log; 
     error_log /var/log/nginx/siremis.error.log; 

     root /usr/share/nginx/html/siremis-4.1.0; 
     index index.php; 

     server_name sip1.<<DOMAIN>>; 

     location /siremis 
     #location ~^/siremis(.+)$ 
     { 
       try_files $uri $uri/ /siremis/index.php?$1; 
     } 

     location ~ .*\.(php|php5)?$ 
     { 
       fastcgi_pass unix:/var/run/php5-fpm.sock; 
       fastcgi_index index.php; 
       include fastcgi_params; 
     } 

     error_page 404 /404.html; 
     error_page 500 502 503 504 /50x.html; 
     location = /50x.html 
     { 
       root /usr/share/nginx/html; 
     } 
} 
+0

哇,我難倒了社區與我的第一個問題。我知道;高度具體的問題。 – DerWanderer

回答

0

下nginx的配置應該讓你的工作;問題是與siremis tarball一起打包的框架返回一個最終會返回的uri,就像/ siremis/siremis/system/general_settings ...這不會被發現。

下面的配置將錯誤重定向到正確的uri;問題是,用這個配置,你的錯誤仍然會被記錄;您可以忽略它們或關閉指令log_not_found;

您可能遇到的另一個問題是某些基於mozilla的瀏覽器;他們對內容類型標題非常嚴格,所以你應該在必要的位置使用包含文件contHandlers.conf來設置標題,否則你可能會遇到加載css,js,gifs favicon ....等錯誤。你需要nginx的,多餘或nginx的全包或網站,提供您的網站的配置與more_set_headers模塊

編譯它是:

server { 
     listen 80; 

     listen [::]:80; 

     charset utf-8; 
     access_log /var/log/nginx/siremis.access.log; 
     error_log /var/log/nginx/siremis.error.log; 

     root /usr/share/nginx/html/siremis-4.1.0; 
     index index.php; 

     server_name sip1.<<DOMAIN>>; 

    include /etc/nginx/mime.types; 

     error_page 404 = @router; 
    location @router { 
     if ($uri ~* (^/siremis)(.*)$){ 
     set $val1 $1 ; 
     set $val2 $2; 
     rewrite .* $val1/index.php$val2 redirect; 
     } 
# remove or create this file if you want to make your own error pages 
    rewrite .* /siremis/errTest.html last;  
    internal ; 
    } 

# this block will redirect you to siremis root 
    location =/ { 
    rewrite .* /siremis redirect;  
    } 

    location /siremis { 
    include /etc/nginx/inc/contHandlers.conf; 
    } 


# remove the install block after you installed 
    location /siremis/install { 
    include /etc/nginx/inc/contHandlers.conf; 

    } 


    location ~^(.+\.php)(.*)$ { 
    fastcgi_split_path_info ^(.+\.php)(.*)$; 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    include /etc/nginx/fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $request_filename; 
    fastcgi_param PATH_INFO $fastcgi_path_info; 
    } 


    location = /favicon.ico { 
     log_not_found off; 
    access_log off; 
     try_files /siremis/favicon.ico =200; 
    } 

} 


#the include /etc/nginx/inc/contHandlers.conf;(this can probably be simplified..some params are commented 

    if ($uri ~* (?=\.(gif|jpg|jpeg|png))) { 
    more_set_headers 'Cache-Control:private, must-revalidate, max-age=144000s'; 
    break; 
    } 

    if ($uri ~* (?=\.css)){ 
    more_set_headers 'Content-Type:text/css' 'Cache-Control: private, must-revalidate, max-age=144000s'; 
    #more_set_headers 'Expires: 7200s'; 
    break; 

} 

    if ($uri ~* (?=\.js)){ 
    more_set_headers 'Content-Type:text/javascript' 'Cache-Control: private, must-revalidate, max-age=144000s'; 
    #expires 72000s; 
    break; 

    } 

    if ($uri ~* (?=\.gif)) { 
    more_set_headers 'Content-Type:image/gif' 'Cache-Control: private, must-revalidate, max-age=144000s'; 
    break; 
    } 

    if ($uri ~* (?=\.(jpg|jpeg))) { 
    more_set_headers 'Content-Type:image/jpeg' 'Cache-Control: private, must-revalidate, max-age=144000s'; 
    break; 
} 

    if ($uri ~* (?=\.png)) { 
    more_set_headers 'Content-Type:image/png' 'Cache-Control: private, must-revalidate, max-age=144000s'; 
    break; 
}