Skip to content

Instantly share code, notes, and snippets.

@foxzool
Created December 5, 2010 03:50
Show Gist options
  • Save foxzool/728752 to your computer and use it in GitHub Desktop.
Save foxzool/728752 to your computer and use it in GitHub Desktop.
my nginx configure of worldpress
location ~/(.*)/wp-admin/$ {
index index.php;
rewrite ^/(.*)/wp-admin/$ /wp-admin/ break;
}
location ~ /(.*)/wp-([a-zA-Z])*\.php {
index index.php;
rewrite ^/(.*)/(.*\.php) /$2 last;
}
location ~ /(.*)/(wp-(?:admin|content|includes).*\.php) {
root /var/www/html/wordpress/;
index index.php;
rewrite ^/(.*)/(wp-(?:admin|content|includes).*\.php) /$2 last;
}
location / {
index index.php;
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)$
{
rewrite ^/.*(/wp-.*/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf))$ $1 last;
rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf))$ /wp-includes/ms-files.php?file=$1 last;
expires 30d;
break;
}
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location ~/(.*)/wp-admin/$ { index index.php; rewrite ^/(.*)/wp-admin/$ /wp-admin/ break;}location ~ /(.*)/wp-([a-zA-Z])*\.php { index index.php; rewrite ^/(.*)/(.*\.php) /$2 last;}location ~ /(.*)/(wp-(?:admin|content|includes).*\.php) { root /var/www/html/wordpress/; index index.php; rewrite ^/(.*)/(wp-(?:admin|content|includes).*\.php) /$2 last;}location / { index index.php; if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; }}location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)${ rewrite ^/.*(/wp-.*/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf))$ $1 last; rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf))$ /wp-includes/ms-files.php?file=$1 last; expires 30d; break;}
location ~ .*\.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment