Skip to content

Instantly share code, notes, and snippets.

@cantremember
Created March 23, 2012 05:58
Show Gist options
  • Save cantremember/2167466 to your computer and use it in GitHub Desktop.
Save cantremember/2167466 to your computer and use it in GitHub Desktop.
nginx Wordpress example
server {
include extra/proxy.conf;
include mime.types;
listen 80;
server_name wiki.DOMAIN.NAME;
access_log logs/LOGFILE-access.log;
###error_log logs/LOGFILE-error.log debug;
error_log logs/LOGFILE-error.log;
# PHP execution only
location ~ \.php$ {
fastcgi_pass fastcgi_cluster;
fastcgi_index pmwiki.php;
# physical location on server
fastcgi_param SCRIPT_FILENAME /PATH/TO/PMWIKI-DIR$fastcgi_script_name;
include fastcgi_params;
}
location / {
# physical location on server
root /PATH/TO/PMWIKI-DIR;
index index.php index.html index.htm;
# 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) {
# ? => &, then remove the leading /
rewrite ^(.*)\?(.*)$ $1&$2;
rewrite ^/(.+)$ /?n=$1 last;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment