Advertisement
Antigua

Wp-network-Nginx-setup

Mar 2nd, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.36 KB | None | 0 0
  1. server {
  2.         ##DM - uncomment following line for domain mapping 
  3.        listen 80 default_server;
  4.     server_name rooshia.com *.rooshia.com; ##Also tried adding childnetwok.com; had no effect
  5.     ##DM - uncomment following line for domain mapping
  6.     server_name_in_redirect off;
  7.  
  8.         access_log   /path-to/rooshia.access.log;
  9.         error_log    /path-to/rooshia.error.log;
  10.  
  11.         root /path-to/htdocs;
  12.         index index.php;
  13.  
  14.         set $cache_uri $request_uri;
  15.  
  16.         # POST requests and urls with a query string should always go to PHP
  17.        if ($request_method = POST) {
  18.                 set $cache_uri 'NULL';
  19.         }
  20.         if ($query_string != "") {
  21.                 set $cache_uri 'NULL';
  22.         }
  23.  
  24.         # Don't cache uris containing the following segments
  25.        if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
  26.                 set $cache_uri 'NULL';
  27.         }
  28.  
  29.         # Don't use the cache for logged in users or recent commenters
  30.        if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
  31.                 set $cache_uri 'NULL';
  32.         }
  33.  
  34.         # Use cached or actual file if they exists, otherwise pass request to WordPress
  35.        location / {
  36.                 try_files /wp-content/cache/page_enhanced${cache_uri}_index.html $uri $uri/ /index.php?$args;
  37.         }
  38.  
  39.         location ~ \.php$ {
  40.                 try_files $uri /index.php;
  41.                 include fastcgi_params;
  42.                 fastcgi_pass unix:/var/run/php5-fpm.sock;
  43.         }
  44.  
  45.         location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
  46.                 access_log off; log_not_found off; expires max;
  47.         }
  48.  
  49.         location = /robots.txt { access_log off; log_not_found off; }
  50.         location ~ /\. { deny  all; access_log off; log_not_found off; }
  51.         location ^~ /wp-content/w3tc- { deny  all; access_log off; log_not_found off; }
  52.  
  53.         #SEO by YOAST for XML Sitemap
  54.        rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
  55.         rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement