Skip to content

Instantly share code, notes, and snippets.

@sofasurfer
Created February 11, 2012 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sofasurfer/1804725 to your computer and use it in GitHub Desktop.
Save sofasurfer/1804725 to your computer and use it in GitHub Desktop.
NGINX WordPress Host File
# NGINX WordPress Virtual Host Config
# @sofasurfer.org
server {
listen 80;
server_name *.mywordpress.com;
root /var/www/mywordpress/;
index index.php;
client_max_body_size 30M;
access_log /var/log/nginx/access-mywordpress.log main;
try_files $uri $uri/ /index.php;
rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
# redirects
if ($host = 'mywordpress.com' ) {
rewrite ^/(.*)$ http://www.mywordpress.com/$1 permanent;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_ignore_client_abort on;
fastcgi_param SERVER_NAME $http_host;
#fastcgi_param HTTPS on;
#fastcgi_param HTTPS $php_https;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment