Search

I just purchased a VPS plan and since it doesn’t have that much ram I decided to use nginx instead of apache. I’ve been trying to figure out how to do the nginx rewrite but just can’t succeed. I’ve tried the nginx rewrite rules for symphony by Jakub and Brett. The installation seems to be OK, and the front page with the default theme can show up without a problem. But individual pages, admin pages all can’t be accessed. I don’t know whether symphony’s rewrite rules has changed since these two rules were written (around July), or it’s something wrong with my VPS. Anyone else tried to run Symphony on nginx?

I don’t know whether symphony’s rewrite rules has changed since these two rules were written (around July)

By the looks of things, yes, they have.

rewrite ^/symphony/(.*)$ /symphony/index.php?page=$1 last;

Should look something like:

rewrite ^/symphony/(.*)$ /index.php?mode=administration&symphony-page=$1 last;

And this:

rewrite ^/(.*)$ /index.php?page=$1 last;

Should look like this:

rewrite ^/(.*)$ /index.php?symphony-page=$1 last;

I installed Symphony on nginx with the following rules (based on your first link). The backend worked but I didn’t check the frontend. There are two changes:

  • the page parameter is now symphony-page
  • there is only one index.php(for front- and backend)

Edit:
The forum did’t like the code. I put it in a gist.

Thank you Nick and klaftertief! It’s working perfectly now!

@feedpuppy: Maybe you can post your nginx rules here – they might be a good reference for other developers!

@michael-e: I just followed klaftertief’s code which he put in a gist.

For reference (in case people miss the edit above), the full gist:

http://gist.github.com/259580

Is anyone using this with Symphony 2.0.7? I can’t for the life of me get it to work for sub-pages. It works for the homepage, but all of my child pages just show the homepage :(

See Rowan Lewis’s post, “Combine Symphony CMS with Nginx”, on his personal site.

Also, this is an interesting tool that could be really handy, htaccess converter for nginx, http://www.anilcetin.com/convert-apache-htaccess-to-nginx/.

Also, the developer is open to share his code, maybe we can consider this to automatically generate a nginx rewrite rules on install.

Hi,

Nginx gives an error when it comes to images:

Image /workspace/0 could not be found.

This is my nginx configuration

location ~ ^(?<path>/dev/gbinterpreting)/(?<admin>symphony)?(?<page>.*)$ {
                # Allow access to files:
                if (-f $request_filename) {
                        break;
                }

                # JIT Image Manipulation:
                if ($page ~ ^image/(.+.(jpg|gif|jpeg|png|bmp))$) {
                        rewrite . $path/extensions/jit_image_manipulation/lib/image.php?param=$1 last;
                }

                # Add trailing slashes:
                if ($request_filename !~ "/$") {
                        rewrite ^(.*)$ $1/ redirect;
                }

                # Block access to manifest:
                if ($page ~ "^manifest/") {
                        return 403;
                }

                # Access Symphony backedn:
                if ($admin) {
                        rewrite . $path/index.php?mode=administration&symphony-page=$page&query_string last;
                }

                # Access Symphony frontend:
                if ($page) {
                        rewrite . $path/index.php?symphony-page=$page last;
                }
        }

This is the link to the website: link text

Any ideas what I might be doing wrong?

Many thanks.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details