This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

This how-to does not explain the base configuration of nginx or php5-fpm. You shouldn't need to change anything else in those configurations to make this work but the plain configurations that come with nginx and php5-fpm should probably be modified and optimized for your setup. I'd recommend using APC with php5-fpm for opcode caching. "the_domain_name.com" is used as an example, of course you can put whatever you want in place of it.

Setup fastcgi_cache in nginx.conf:

    fastcgi_cache_path      /var/lib/nginx/cache levels=1:2
                            keys_zone=c5:10m
                            inactive=5m;
    fastcgi_cache_key "$scheme$request_method$host$request_uri";
    fastcgi_cache_use_stale error timeout invalid_header http_500;

Configure the_domain_name.com.conf:

server {
    listen 80; # Default listen port
    server_name the_domain_name.com;
    server_name www.the_domain_name.com;
    access_log /var/www/sites/the_domain_name.com/logs/access.log;
    error_log /var/www/sites/the_domain_name.com/logs/error.log debug;
    gzip on;
    gzip_vary on;
    gzip_disable msie6;
    gzip_static on;
    gzip_comp_level 9;
    gzip_proxied any;
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    client_max_body_size 20m;

    root   /var/www/sites/the_domain_name.com/public_html;
    index  index.html index.htm index.php;

    location ~ /\. { deny all; access_log off; log_not_found off; }

    location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
        expires max;
        log_not_found off;
    }

    set $skip_cache 0;

    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
        set $skip_cache 1;
    }
    if ($query_string != "") {
        set $skip_cache 1;
    }
    if ($http_cookie ~ "CONCRETE5") {
        set $skip_cache 1;
    }

    location / {
        try_files $uri $uri/ /index.php$uri;
        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 {
        include fastcgi_params;
        fastcgi_pass unix:/tmp/the_domain_name.php5-fpm.sock;
        fastcgi_cache_bypass $skip_cache;
        fastcgi_no_cache $skip_cache;
        fastcgi_cache c5;
        fastcgi_cache_valid   any      1m;
    }
}

Edit /etc/php5/fpm/pool.d/the_domain_name.com.conf:

[the_domain_name]
user = the_domain_name
group = the_domain_name
listen = /tmp/the_domain_name.php5-fpm.sock
request_slowlog_timeout = 5s
slowlog = /var/www/sites/the_domain_name.com/logs/php-slow.log
request_terminate_timeout = 120s
pm = dynamic
pm.max_children = 6
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 200
listen.backlog = -1
pm.status_path = /status
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
php_admin_value[session.save_path] = "/var/www/sites/the_domain_name.com/session"
php_flag[display_errors] = on
php_admin_value[error_log] = "/var/www/sites/the_domain_name.com/logs/php-error.log"
php_admin_flag[log_errors] = on
Loading Conversation