Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!

nginx.conf

By: jpasswaters on Oct 28th, 2012  |  syntax: None  |  size: 4.45 KB  |  views: 1,179  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. server {
  2.     listen       80;
  3.     server_name  localhost;
  4.  
  5.     #charset koi8-r;
  6.     #access_log  /var/log/nginx/log/host.access.log  main;
  7.  
  8.     location / {
  9.         root   /usr/share/nginx/html;
  10.         index  index.html index.htm;
  11.     }
  12.        
  13.  
  14.     #error_page  404              /404.html;
  15.  
  16.     # redirect server error pages to the static page /50x.html
  17.     #
  18.     error_page   500 502 503 504  /50x.html;
  19.     location = /50x.html {
  20.         root   /usr/share/nginx/html;
  21.     }
  22.  
  23. }
  24.  
  25. server {
  26.     ## Your website name goes here.
  27.     server_name mysite.com test.mysite.com;
  28.     ## Your only path reference.
  29.     root /var/www/;
  30.     listen 80;
  31.         #listen 127.0.0.1;
  32.        
  33.         client_max_body_size 20M;
  34.     ## This should be in your http block and if it is, it's not needed here.
  35.     index index.html index.htm index.php;
  36.  
  37.     include conf.d/drop;
  38.  
  39.         location / {
  40.                 # This is cool because no php is touched for static content
  41.                         try_files $uri $uri/ /index.php?q=$uri&$args;
  42.         }
  43.  
  44.         location ~ \.php$ {
  45.             fastcgi_buffers 8 256k;
  46.             fastcgi_buffer_size 128k;
  47.                         #fastcgi_pass 127.0.0.1:9000;
  48.             fastcgi_intercept_errors on;
  49.             include fastcgi_params;
  50.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  51.             fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
  52.  
  53.  
  54.         }
  55.                
  56.                 location /phpmyadmin {
  57.                root /usr/share/;
  58.                index index.php index.html index.htm;
  59.                location ~ ^/phpmyadmin/(.+\.php)$ {
  60.                        try_files $uri =404;
  61.                        root /usr/share/;
  62.                        fastcgi_pass 127.0.0.1:9000;
  63.                        fastcgi_index index.php;
  64.                        fastcgi_param SCRIPT_FILENAME /usr/share/$fastcgi_script_name;
  65.                        include /etc/nginx/fastcgi_params;
  66.                }
  67.                location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
  68.                        root /usr/share/;
  69.                }
  70.         }
  71.         location /phpMyAdmin {
  72.                rewrite ^/* /phpmyadmin last;
  73.         }
  74.                
  75.                
  76.                
  77.                
  78. # BEGIN W3TC Page Cache cache
  79. location ~ /wp-content/w3tc/pgcache.*html$ {
  80.     add_header Vary "Accept-Encoding, Cookie";
  81. }
  82. location ~ /wp-content/w3tc/pgcache.*gzip$ {
  83.     gzip off;
  84.     types {}
  85.     default_type text/html;
  86.     add_header Vary "Accept-Encoding, Cookie";
  87.     add_header Content-Encoding gzip;
  88. }
  89. # END W3TC Page Cache cache
  90. # BEGIN W3TC Browser Cache
  91. gzip on;
  92. gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
  93. location ~ \.(css|js|htc)$ {
  94. }
  95. location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
  96. }
  97. location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
  98. }
  99. # END W3TC Browser Cache
  100. # BEGIN W3TC Page Cache core
  101. rewrite ^(.*\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 last;
  102. set $w3tc_rewrite 1;
  103. if ($request_method = POST) {
  104.     set $w3tc_rewrite 0;
  105. }
  106. if ($query_string != "") {
  107.     set $w3tc_rewrite 0;
  108. }
  109. if ($http_host !~ "connectingdirectors.com") {
  110.     set $w3tc_rewrite 0;
  111. }
  112. set $w3tc_rewrite3 1;
  113. if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|\/feed\/|wp-.*\.php|index\.php)") {
  114.     set $w3tc_rewrite3 0;
  115. }
  116. if ($request_uri ~* "(wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
  117.     set $w3tc_rewrite3 1;
  118. }
  119. if ($w3tc_rewrite3 != 1) {
  120.     set $w3tc_rewrite 0;
  121. }
  122. if ($http_cookie ~* "(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in)") {
  123.     set $w3tc_rewrite 0;
  124. }
  125. if ($http_user_agent ~* "(W3\ Total\ Cache/0\.9\.2\.4)") {
  126.     set $w3tc_rewrite 0;
  127. }
  128. set $w3tc_ua "";
  129. set $w3tc_ref "";
  130. set $w3tc_ssl "";
  131. set $w3tc_enc "";
  132. if ($http_accept_encoding ~ gzip) {
  133.     set $w3tc_enc _gzip;
  134. }
  135. set $w3tc_ext "";
  136. if (-f "$document_root/wp-content/w3tc/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl.html$w3tc_enc") {
  137.     set $w3tc_ext .html;
  138. }
  139. if ($w3tc_ext = "") {
  140.   set $w3tc_rewrite 0;
  141. }
  142. if ($w3tc_rewrite = 1) {
  143.     rewrite .* "/wp-content/w3tc/pgcache/$request_uri/_index$w3tc_ua$w3tc_ref$w3tc_ssl$w3tc_ext$w3tc_enc" last;
  144. }
  145. # END W3TC Page Cache core
  146.  
  147. }