Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated sample configs to something that actually works

  • Loading branch information...
commit 5f15b775b5a27e0c48a3ed2346664fe3fbd66af9 1 parent df0b5ad
@ryanmark ryanmark authored
View
46 sample-http/development-nginx.conf
@@ -33,20 +33,28 @@ server {
try_files $uri $uri/ /index.php?$args;
}
- location ^~ /wp-content/plugins {
- alias /tmp/nginxroot/plugins;
- }
- location ^~ /wp-content/themes {
- alias /tmp/nginxroot/themes;
- }
- location ^~ /wp-content/blogs.dir {
- alias /tmp/nginxroot/media/blogs.dir;
+ # If we have a php file to run from a plugin or theme, do this
+ location ~ wp-content/(plugins|themes)/(.*\.php)$ {
+ alias /tmp/nginxroot/$1/$2;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ include /usr/local/etc/nginx/fastcgi_params;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ #fastcgi_intercept_errors on;
+ fastcgi_pass unix:/tmp/php5-fpm.sock;
}
- location ^~ /wp-content/uploads {
- alias /tmp/nginxroot/media/uploads;
+
+ # If we are trying to load any other static file, do this
+ location ~ wp-content/(plugins|themes|blogs\.dir|uploads|fragment-cache)/(.*)$ {
+ alias /tmp/nginxroot/$1/$2;
}
- location ^~ /wp-content/media {
- alias /tmp/nginxroot/media;
+
+ # If you setup blog slug symlinks in blogs.dir, turn this on to serve media directly
+ #rewrite ^/([^/]+/files/.+)$ /blogs.dir/$1 last;
+
+ # Otherwise, have WordPress find the file and send it
+ if ($uri !~ wp-content) {
+ rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Add trailing slash to */wp-admin requests.
@@ -59,18 +67,12 @@ server {
log_not_found off;
}
- # Pass uploaded files to wp-includes/ms-files.php.
- rewrite /files/$ /index.php last;
-
- if ($uri !~ wp-content/plugins) {
- 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-]+.*(/wp-admin/.*\.php)$ $1 last;
- rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/wp-includes.*) $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/wp-admin.*) $1 last;
+ #rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/[^/]*\.php)$ $1 last;
}
# Pass all .php files onto a php-fpm/php-fcgi server.
View
46 sample-http/production-nginx.conf
@@ -31,20 +31,28 @@ server {
try_files $uri $uri/ /index.php?$args;
}
- location ^~ /wp-content/plugins {
- alias /home/wordpress/sites/example/plugins;
- }
- location ^~ /wp-content/themes {
- alias /home/wordpress/sites/example/themes;
- }
- location ^~ /wp-content/blogs.dir {
- alias /home/wordpress/sites/example/media/blogs.dir;
+ # If we have a php file to run from a plugin or theme, do this
+ location ~ wp-content/(plugins|themes)/(.*\.php)$ {
+ alias /home/wordpress/sites/chicagonow/$1/$2;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ include fastcgi_params;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ #fastcgi_intercept_errors on;
+ fastcgi_pass unix:/tmp/php5-fpm.sock;
}
- location ^~ /wp-content/uploads {
- alias /home/wordpress/sites/example/media/uploads;
+
+ # If we are trying to load any other static file, do this
+ location ~ wp-content/(plugins|blogs\.dir|themes|uploads|fragment-cache)/(.*)$ {
+ alias /home/wordpress/sites/chicagonow/$1/$2;
}
- location ^~ /wp-content/media {
- alias /home/wordpress/sites/example/media;
+
+ # If you setup blog slug symlinks in blogs.dir, turn this on to serve media directly
+ #rewrite ^/([^/]+/files/.+)$ /blogs.dir/$1 last;
+
+ # Otherwise, have WordPress find the file and send it
+ if ($uri !~ wp-content) {
+ rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Add trailing slash to */wp-admin requests.
@@ -57,18 +65,12 @@ server {
log_not_found off;
}
- # Pass uploaded files to wp-includes/ms-files.php.
- rewrite /files/$ /index.php last;
-
- if ($uri !~ wp-content/plugins) {
- 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-]+.*(/wp-admin/.*\.php)$ $1 last;
- rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/wp-includes.*) $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/wp-admin.*) $1 last;
+ #rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/[^/]*\.php)$ $1 last;
}
# Pass all .php files onto a php-fpm/php-fcgi server.
View
46 sample-http/staging-nginx.conf
@@ -31,20 +31,28 @@ server {
try_files $uri $uri/ /index.php?$args;
}
- location ^~ /wp-content/plugins {
- alias /home/wordpress/sites/example/plugins;
- }
- location ^~ /wp-content/themes {
- alias /home/wordpress/sites/example/themes;
- }
- location ^~ /wp-content/blogs.dir {
- alias /home/wordpress/sites/example/media/blogs.dir;
+ # If we have a php file to run from a plugin or theme, do this
+ location ~ wp-content/(plugins|themes)/(.*\.php)$ {
+ alias /home/wordpress/sites/example/$1/$2;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ include fastcgi_params;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ #fastcgi_intercept_errors on;
+ fastcgi_pass unix:/tmp/php5-fpm.sock;
}
- location ^~ /wp-content/uploads {
- alias /home/wordpress/sites/example/media/uploads;
+
+ # If we are trying to load any other static file, do this
+ location ~ wp-content/(plugins|blogs\.dir|themes|uploads|fragment-cache)/(.*)$ {
+ alias /home/wordpress/sites/example/$1/$2;
}
- location ^~ /wp-content/media {
- alias /home/wordpress/sites/example/media;
+
+ # If you setup blog slug symlinks in blogs.dir, turn this on to serve media directly
+ #rewrite ^/([^/]+/files/.+)$ /blogs.dir/$1 last;
+
+ # Otherwise, have WordPress find the file and send it
+ if ($uri !~ wp-content) {
+ rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
}
# Add trailing slash to */wp-admin requests.
@@ -57,18 +65,12 @@ server {
log_not_found off;
}
- # Pass uploaded files to wp-includes/ms-files.php.
- rewrite /files/$ /index.php last;
-
- if ($uri !~ wp-content/plugins) {
- 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-]+.*(/wp-admin/.*\.php)$ $1 last;
- rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/wp-includes.*) $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/wp-admin.*) $1 last;
+ #rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
+ rewrite ^/[_0-9a-zA-Z-]+(/[^/]*\.php)$ $1 last;
}
# Pass all .php files onto a php-fpm/php-fcgi server.
Please sign in to comment.
Something went wrong with that request. Please try again.