Skip to content

Instantly share code, notes, and snippets.

@highruned
Created February 23, 2011 08:47
Show Gist options
  • Save highruned/840183 to your computer and use it in GitHub Desktop.
Save highruned/840183 to your computer and use it in GitHub Desktop.
server {
listen 80; ## listen for ipv4
server_name mysite.com;
access_log /var/log/nginx/localhost.access.log;
location / {
root /home/myuser/mysite/www;
index index.php;
if (-e $request_filename) {
break;
}
set $test_var true;
if ($request_method = POST) { set $test_var false; }
if ($http_X_Requested_With !~ XMLHttpRequest) { set $test_var false; }
if ($test_var = true) {
rewrite ^([^.|]*[^/])$ $1/ permanent;
}
rewrite ^(.*)$ /index.php?q=$1 last;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/myuser/mysite/www$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment