我正在尝试在运行Nginx的Ubuntu 14.04上部署Siremis 4.1(http://siremis.asipto.com/2014/03/25/siremis-v4-1-0-released/)。关于在网络上运行Nirex上的Siremis的信息非常少。我已经正确安装了所有内容(我认为),但是我在使用Nginx配置时遇到了问题,无法正确地为这些页面提供服务。
我几乎可以肯定问题是在URL重写中。我可以去这个页面没问题:
DOMAIN / siremis / index.php的/用户/登录
但是之后我用这个URL获得了Page Not Found:
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 :(得分:0)
下面的nginx配置可以让你工作;问题是与siremis tarball打包在一起的框架会返回一个uri,最终会像/ siremis / siremis / system / general_settings那样回来......这些都无法找到。
以下配置将错误重定向到正确的uri;问题是,使用此配置,您的错误仍将被记录;你可以忽略它们或者使用指令log_not_found off;
您可能遇到的另一个问题是基于某些基于Mozilla的浏览器;他们对内容类型标题非常严格,所以你应该在必要的位置使用包含的文件contHandlers.conf设置标题,否则你可能会在加载css,js,gifs favicon等时出错...你需要nginx-extra或nginx-full软件包或使用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;
}