Running Nginx with Concrete5

I’ve been sitting here all day bashing my head against one simple problem – getting Concrete5 working behind Nginx.

Concrete5 is a beautiful, simple php-based CMS – a loud answer to the complexity of Joomla and Drupal, but of course missing some of the power too. It’s perfect for web sites that aren’t managed by total geeks.

Nginx is the world’s fastest and most efficient web server. Hands down, no competition, no argument.

The problem I had integrating the two stems from nginx+php-fastcgi not correctly passing through the PATH_INFO variable so you can have URLs like “”.

The solution was to slightly alter the usual php-fastcgi parameter processing. Below is my complete config for my concrete5 site. This worked on Debian Lenny with nginx 0.7.59.


server {
        listen          80;
        autoindex on;

    location / {
           root /var/www/;
                index index.php;

        if (!-f $request_filename){
                   set $rule_0 1$rule_0;
               if (!-d $request_filename){
                    set $rule_0 2$rule_0;
               if ($rule_0 = "21"){
                    rewrite ^/(.*)$ /index.php/$1 last;

        location ~ .php($|/) {
           set  $script     $uri;
            set  $path_info  "";

            if ($uri ~ "^(.+.php)(/.+)") {
              set  $script     $1;
              set  $path_info  $2;
          fastcgi_index  index.php;
          fastcgi_param  SCRIPT_FILENAME  /var/www/$fastcgi_script_name;
      fastcgi_param URI $uri; 
      fastcgi_param PATH_INFO $path_info;
          include        /etc/nginx/fastcgi.conf;

5 thoughts on “Running Nginx with Concrete5

  1. Tom

    Thanks for the tip. Very helpful. I’ll try it out.
    As for Nginx not having competitors, from my experience there are both commercial (Zeus) and open source (Cherokee) web servers that are even faster.

    I haven’t been able to run Cherokee with Concrete5, though. Not yet.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.