ScaleScaleScaleScale

Tips / Nginx


Nginx configuration for Symphony CMS

Symphony CMS, as the title suggests, is an open-source Content Management System that allows you to easily publish and manage all the web content you need while creating beautiful and powerful websites. It can be used as as simple web log like WordPress, to build a complex online portal or for e-commerce websites.

Today we are going to see what rewrite rules you will need in order to have Symphony CMS workig on Nginx.

By the way, this is not related to the PHP Framework named Symfony.

location / {
    index index.php;

    ### Static files.
    if (-f $request_filename) {
      access_log        off;
      expires           15d;
      break;
    }

    ### Backend.
    if ($request_filename ~ /symphony/) {
      rewrite ^/symphony/?$ /index.php?mode=administration&$query_string last;
      rewrite ^/symphony(/(.*/?))?$ /index.php?symphony-page=$1&mode=administration&$query_string last;
    }

    ### Images config.
    rewrite ^/image/(.+.(jpg|gif|jpeg|png|bmp|JPG|GIF|JPEG|PNG|BMP))$ /extensions/jit_image_manipulation/lib/image.php?param=$1 last;

    ## Add trailing slash
    rewrite ^(.*[^/])$ $1/ permanent;

    ### Main rewrite rule for Symphony CMS
    if (!-d $request_filename) {
        rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
    }

}

Place this configuration inside your http block and that’s all. Reload your nginx to apply the changes:

service nginx reload

Popular search terms:

  • symphony cms
  • https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1823 z0LdvwoKOt55ZPnbLu8zBqjKKEvbOGcegHt1bVE4qJxhyJ-ig-TK5JGgfW4Pb0CW 6199dee3c38c9a46f0cb0844fb39ea03e1d846a1&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
  • symphony nginx
profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking