Getting Textpattern to Work With Nginx

Textpattern really doesn’t play so nicely with Nginx out-of-the-box.


If you’re thinking about giving these two a go with each other, this little snippet may help you out. Open up or create the file for your website that goes into the sites-available directory and add the below along with what you have so far. Make sure to change the socket to TCP if that’s what you use in your set up.

    location / {
		try_files $uri $uri/ /index.php?$args;
    }
	
	location ~ .php$ {
		fastcgi_split_path_info ^(.+.php)(/.+)$;
		fastcgi_pass unix:/var/run/php5-fpm.socket;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME         $document_root$fastcgi_script_name;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		include fastcgi_params;
	}

	rewrite ^(.*)/category/(.*)/$ $1/index.php?c=$2 last;
	rewrite ^(.*)/category/(.*)$ $1/index.php?c=$2 last;
	rewrite ^(.*)/rss/$ $1/index.php?rss=1 last;
	rewrite ^(.*)/atom/$ $1/index.php?atom=1 last; 
	rewrite ^(.*)/tag/(.*)/$ $1/index.php?s=tag&t=$2 last;
	rewrite ^(.*)/tag/(.*)$ $1/index.php?s=tag&t=$2 last;