Advertisement
livefree

default.conf

Jan 29th, 2013
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.96 KB | None | 0 0
  1. server {
  2.     ## Your website name goes here.
  3.    server_name livefreedietravelling.com www.livefreedietravelling.com;
  4.     ## Your only path reference.
  5.    root /var/www/;
  6.     listen 8080;
  7.     ## This should be in your http block and if it is, it's not needed here.
  8.    index index.html index.htm index.php;
  9.  
  10.     # added from http://calendar.perfplanet.com/2012/using-nginx-php-fpmapc-and-varnish-to-make-wordpress-websites-fly/ - 28th Dec 2012
  11.    server_tokens off;
  12.     autoindex off;
  13.     client_max_body_size 15m;
  14.     client_body_buffer_size 128k;
  15.     expires 86400s;
  16.     add_header Pragma public;
  17.     add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";
  18.     error_page 403 = 404;
  19.     location ~ /(\.|wp-config.php|readme.html|licence.txt) {
  20.         return 404;
  21.     }
  22.     rewrite /wp-admin$ $scheme://$host$uri/ permanent;
  23.     location ~* ^.+\.(css|js)$ {
  24.         rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
  25.         expires 31536000s;
  26.         access_log off;
  27.         log_not_found off;
  28.         add_header Pragma public;
  29.         add_header Cache-Control "max-age=31536000, public";
  30.     }
  31.     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|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
  32.         expires 360d;
  33.         access_log off;
  34.         log_not_found off;
  35.         add_header Pragma public;
  36.         add_header Cache-Control "max-age=31536000, public";
  37.     }
  38.     location ~* (^(?!(?:(?!(php|inc)).)*/uploads/).*?(php)) {
  39.         try_files $uri = 404;
  40.         fastcgi_split_path_info ^(.+.php)(.*)$;
  41.         fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
  42.         fastcgi_index index.php;
  43.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  44.         include fastcgi_params;
  45.         fastcgi_intercept_errors on;
  46.         fastcgi_ignore_client_abort off;
  47.         fastcgi_connect_timeout 120;
  48.         fastcgi_send_timeout 180;
  49.         fastcgi_read_timeout 180;
  50.         fastcgi_buffer_size 128k;
  51.         fastcgi_buffers 4 256k;
  52.         fastcgi_busy_buffers_size 256k;
  53.         fastcgi_temp_file_write_size 256k;
  54.     }
  55.  
  56.  
  57.     # added from http://phpbugs.wordpress.com/2012/10/29/nginx-upstream-timed-out-110-connection-timed-out-while-reading-response-header-from-upstream/
  58.    proxy_read_timeout 120;
  59.  
  60.     include conf.d/drop;
  61.  
  62.         location / {
  63.                 # This is cool because no php is touched for static content
  64.             try_files $uri $uri/ /index.php?q=$uri&$args;
  65.        
  66.    # Added to Rewrite TimThumb to Pretty URL so compatible with CDN
  67.             rewrite ^/cdn-thumb/(.*)$ /wp-content/themes/sahifa/timthumb.php?$1 last;
  68.            
  69.     }
  70.  
  71. # MAKE SURE TO UNCOMMENT IF ABOVE IMPORTED CONFIG DOES NOT WORK
  72. #
  73. #        location ~ \.php$ {
  74. #           fastcgi_buffers 8 256k;
  75. #            fastcgi_buffer_size 128k;
  76. #            fastcgi_intercept_errors on;
  77. #            include fastcgi_params;
  78. #            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  79. #            fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
  80. #
  81. #
  82. #        }
  83.  
  84. # BEGIN Better WP Security
  85. set $susquery 0;
  86.     set $rule_2 0;
  87.     set $rule_3 0;
  88.     if ($request_method ~* "^(TRACE|DELETE|TRACK)"){ return 403; }
  89.     location /wp-comments-post.php {
  90.         valid_referers jetpack.wordpress.com/jetpack-comment/ *.livefreedietravelling.com;
  91.         set $rule_0 0;
  92.         if ($request_method ~ "POST"){ set $rule_0 1$rule_0; }
  93.         if ($invalid_referer) { set $rule_0 2$rule_0; }
  94.         if ($http_user_agent ~ "^$"){ set $rule_0 3$rule_0; }
  95.         if ($rule_0 = "3210") { return 403; }
  96.     }    if ($http_cookie !~* "wordpress_logged_in_" ) {
  97.         set $susquery 2$susquery;
  98.         set $rule_2 1;
  99.         set $rule_3 1;
  100.     }
  101.     if ($args !~ "^loggedout=true") { set $susquery 3$susquery; }
  102. # END Better WP Security
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement