Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. fastcgi_cache_path /var/run/proxy_cache levels=1:2 keys_zone=thecurlysue.com:100m max_size=10g inactive=300m;
  2.  
  3. server {
  4. listen 80;
  5. listen [::]:80;
  6.  
  7. access_log /var/log/nginx/proxy-access.log;
  8. error_log /var/log/nginx/proxy-error.log;
  9.  
  10. add_header X-Cache $upstream_cache_status;
  11.  
  12. root /var/www/thecurlysue.com;
  13. index index.php;
  14.  
  15. set $skip_cache 0;
  16.  
  17. # POST requests and urls with a query string should always go to PHP
  18. if ($request_method = POST) {
  19. set $skip_cache 1;
  20. }
  21. if ($query_string != "") {
  22. set $skip_cache 1;
  23. }
  24.  
  25. # Don't cache uris containing the following segments
  26. if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
  27. set $skip_cache 1;
  28. }
  29.  
  30. # Don't use the cache for logged in users or recent commenters
  31. if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
  32. set $skip_cache 1;
  33. }
  34.  
  35. location / {
  36. allow 192.88.134.0/23;
  37. allow 185.93.228.0/22;
  38. allow 2a02:fe80::/29;
  39. allow 66.248.200.0/22;
  40. deny all;
  41.  
  42.  
  43. try_files $uri $uri/ /index.php?$args;
  44. }
  45.  
  46. location ~ \.php$ {
  47. allow 192.88.134.0/23;
  48. allow 185.93.228.0/22;
  49. allow 2a02:fe80::/29;
  50. allow 66.248.200.0/22;
  51. deny all;
  52.  
  53. try_files $uri =404;
  54. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  55. fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
  56. fastcgi_index index.php;
  57. include fastcgi_params;
  58.  
  59. fastcgi_cache_bypass $skip_cache;
  60. fastcgi_no_cache $skip_cache;
  61. fastcgi_cache thecurlysue.com;
  62. fastcgi_cache_valid 300m;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement