Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. server {
  2. listen 80;
  3.  
  4. root /usr/share/nginx/html/xxxxxxx;
  5. index index.php index.html index.htm;
  6.  
  7. server_name xxxxxxxx www.xxxxxxx;
  8. access_log /var/log/nginx/hypoxico.ru.access.log;
  9. error_log /var/log/nginx/hypoxico.ru.error.log;
  10.  
  11. #SEO for xml-sitemap
  12. rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
  13. rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
  14.  
  15. location / {
  16. try_files $uri $uri/ /index.php?q=$uri&$args;
  17.  
  18. }
  19. gzip on;
  20. gzip_http_version 1.1;
  21. gzip_vary on;
  22. gzip_comp_level 6;
  23. gzip_proxied any;
  24. gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
  25. gzip_buffers 16 8k;
  26. gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  27.  
  28. ########test
  29. # Ensure requests for pagespeed optimized resources go to the pagespeed handler
  30. # and no extraneous headers get set.
  31. location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
  32. add_header "" "";
  33. }
  34. location ~ "^/pagespeed_static/" { }
  35. location ~ "^/ngx_pagespeed_beacon$" { }
  36. # Google Analytics Proxy
  37. rewrite ^/ga.js$ /ga/ last;
  38.  
  39. location /ga/ {
  40. proxy_pass http://www.google-analytics.com/ga.js;
  41. break;
  42. }
  43.  
  44. ##########test
  45. error_page 404 /404.html;
  46.  
  47. error_page 500 502 503 504 /50x.html;
  48.  
  49.  
  50. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  51. location ~ \.php$ {
  52. try_files $uri =404;
  53. fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/xxxxxxx$fastcgi_script_name;
  54. fastcgi_pass unix:/var/run/php5-fpm.sock;
  55. fastcgi_index index.php;
  56. include fastcgi_params;
  57. }
  58.  
  59. location ~ /\.ht {
  60. deny all;
  61. }
  62.  
  63. autoindex off;
  64.  
  65. auth_basic_user_file /etc/nginx/htpasswd;
  66.  
  67.  
  68. # Disallow access to important files
  69. location ~* (/\.|wp-config.php|(?<!robots)\.txt|(liesmich|readme).*) {
  70. return 444;
  71. }
  72. # Auth protection xmlrpc.php
  73. location = /xmlrpc.php {
  74. auth_basic "Restricted Admin-Area";
  75. auth_basic_user_file /etc/nginx/htpasswd;
  76. }
  77.  
  78. # Disable direct access of any *.php files in /wp_includes folder
  79. location ~ ^/wp-includes/.+\.php$ {
  80. return 444;
  81. }
  82.  
  83. # Disable direct access of any *.php in /wp_content folder
  84. location ~ ^/wp-content/.+\.php$ {
  85. return 444;
  86. }
  87. # Disable direct access of any *.php in /wp_content/uploads folder
  88. location ~ ^/wp-content/uploads/.+\.php$ {
  89. return 444;
  90. }
  91.  
  92. location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|htm|html|woff)$
  93. {
  94. expires 30d;
  95. }
  96.  
  97. pagespeed on;
  98. pagespeed InPlaceResourceOptimization off;
  99. pagespeed DownstreamCachePurgeLocationPrefix http://localhost:80/;
  100. #pagespeed ModPagespeedModifyCachingHeaders off;
  101. pagespeed EnableFilters extend_cache;
  102. include blacklist.conf;
  103.  
  104. # Defer and minify Javascript
  105. pagespeed EnableFilters defer_javascript;
  106. pagespeed EnableFilters rewrite_javascript;
  107. pagespeed EnableFilters combine_javascript;
  108. pagespeed EnableFilters canonicalize_javascript_libraries;
  109.  
  110. # Inline and minimize css
  111. pagespeed EnableFilters rewrite_css;
  112. pagespeed EnableFilters fallback_rewrite_css_urls;
  113. # Loads CSS faster
  114. #pagespeed EnableFilters move_css_above_scripts;
  115. pagespeed EnableFilters move_css_to_head;
  116.  
  117.  
  118. # remove tags with default attributes
  119. pagespeed EnableFilters elide_attributes;
  120.  
  121.  
  122. #pagespeed PreserveUrlRelativity on;
  123. pagespeed RespectVary off;
  124. pagespeed DisableRewriteOnNoTransform off;
  125. pagespeed LowercaseHtmlNames on;
  126.  
  127. pagespeed RewriteLevel PassThrough;
  128. pagespeed EnableFilters combine_css,extend_cache;
  129. pagespeed EnableFilters rewrite_css,rewrite_javascript;
  130.  
  131. ############### test ###############
  132. open_file_cache max=200000 inactive=14d;
  133. open_file_cache_valid 1m;
  134. open_file_cache_min_uses 2;
  135. open_file_cache_errors on;
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement