Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nginx, GetSimple CMS and preety urls, too.
#4
Okay, here is the conf I've used (it's based on that for wordpress, so in case you want to deploy simplecms on nginx, google for deploying worpdress, try it, see that it works (or just find the php part, since we don't need mysql for simplecms).

vim /etc/nginx/sites-available/test.com
Code:
server {
    listen   80;
    #TODO: make www to redirect!
    server_name test.com;
    access_log /var/log/nginx/test.com.access.log;
    error_log /var/log/nginx/test.com.error.log;

    location / {
        root   /var/www/test.com;
        index  index.html index.htm index.php;

        # this serves static files that exist without running other rewrite tests
        if (-f $request_filename) {
            expires 30d;
            break;
        }

        # this sends all non-existing file or directory requests to index.php
        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?id=$1 last;
        }
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/test.com$fastcgi_script_name;
    }
}
So, everything I needed to change (everything that is different from wordpress) is that rewrite rule:
instead of
Code:
rewrite ^(.+)$ /index.php?q=$1 last;

we do
Code:
rewrite ^(.+)$ /index.php?id=$1 last;
(substituted q with id)

Help this will help to somebody Smile

PS I am deploying PHP with php-fpm, google "nginx php-fpm"
Reply


Messages In This Thread
Nginx, GetSimple CMS and preety urls, too. - by misha.reyzlin - 2010-03-26, 08:00:08



Users browsing this thread: 3 Guest(s)