1

I'm trying to deploy Siremis 4.1 (http://siremis.asipto.com/2014/03/25/siremis-v4-1-0-released/) on Ubuntu 14.04 running Nginx. There is very little information on running Siremis on Nginx on the web. I got everything installed properly (I think), but I am having a problem with the Nginx configuration to properly serve the pages.

I'm almost sure that the problem is in the URL rewrites. I can go to this page no problem:

DOMAIN/siremis/index.php/user/login

But I get Page Not Found after that with this URL:

DOMAIN/siremis/system/general_default

This reminds me of WordPress's permalinks, which I was able to get working with very little problems thanks to their excellent documentation: http://codex.wordpress.org/Nginx

But, Siremis is another matter. I'm not sure if Siremis just doesn't support working with Nginx because it expects Apache when performing redirects or what. Just wondering if anyone has any suggestions. I'm new to Nginx, obviously. Or if anyone knows how to turn off the redirects in Siremis, that would be fine too! I don't need to have the "pretty" URLs.

Here's my server configuration:

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;
        }
}

1 Answers1

0

The nginx config below should get you working; the problem is that the framework packaged with the siremis tarball returns a uri that ultimately comes back as like /siremis/siremis/system/general_settings ...which won't be found.

The below config redirects the error to the correct uri; problem is, with this config, your errors will still be logged; you can ignore them or play with directive log_not_found off;

Another problem you might have is with some mozilla based browsers; they are very strict with the content-type headers so you should set the headers using an included file contHandlers.conf in the necessary locations or you might get errors loading css, js, gifs favicon ....etc... you need the nginx-extra or nginx-full package or compile it with more_set_headers module

in sites-available your site config is:

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; 
}
cpc
  • 1
  • 1