Skip to content

Instantly share code, notes, and snippets.

@c3mdigital
Created May 22, 2012 00:24
Show Gist options
  • Save c3mdigital/2765663 to your computer and use it in GitHub Desktop.
Save c3mdigital/2765663 to your computer and use it in GitHub Desktop.
Updated Ningx.conf and WordPress multi site block
## Start nginx.conf
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 3;
client_max_body_size 13m;
index index.php index.html index.htm;
# Upstream to abstract backend connection(s) for PHP.
upstream php {
# Make sure listen is set to: listen = /var/run/php5-fpm.sock in /etc/php5/fpm/pool.d/www.conf
server unix:/var/run/php5-fpm.sock;
}
include sites-enabled/*;
}
## End nginx.conf
## Start /etc/nginx/sites-enabled/default.conf
error_page 404 = @wordpress;
log_not_found off;
server {
listen 80;
server_name yourdomain.org www.yourdomain.org;
root /var/www/public/directory;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/files/(.+) /wp-includes/ms-files.php?file=$1 last;
location ^~ /files/ {
rewrite ^.*/files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Rewrite multisite '.../wp-.*' and '.../*.php'.
if (!-e $request_filename) {
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
location @wordpress {
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
fastcgi_param SCRIPT_NAME /index.php;
}
location ~ \.php$ {
fastcgi_max_temp_file_size 1M;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
try_files $uri @wordpress;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment