Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. Cache-Control
  2. max-age=86400
  3. Connection
  4. keep-alive
  5. Content-Encoding
  6. gzip
  7. Content-Type
  8. text/css
  9. Date
  10. Wed, 18 Jan 2017 16:00:34 GMT
  11. Expires
  12. Thu, 19 Jan 2017 16:00:34 GMT
  13. Last-Modified
  14. Mon, 19 Oct 2015 09:26:18 GMT
  15. Server
  16. nginx/1.4.6 (Ubuntu)
  17. Transfer-Encoding
  18. chunked
  19. Vary
  20. Accept-Encoding
  21. X-Cache-Status
  22. MISS
  23.  
  24. proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=TOMCAT:50m max_size=100m;
  25. server {
  26. listen 80;
  27. server_name *.xyz.com;
  28. default_type text/html;
  29. return 307 https://$host$request_uri;
  30. root /var/lib/tomcat7/webapps;
  31. index index.html index.jsp;
  32. location / {
  33. set $no_cache "";
  34. if ($request_method !~ ^(GET|HEAD)$) {
  35. set $no_cache "1";
  36. }
  37. if ($no_cache = "1") {
  38. add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
  39. add_header X-Microcachable "0";
  40. }
  41. if ($http_cookie ~* "_mcnc") {
  42. set $no_cache "1";
  43. }
  44. if ($request_uri ~* ".(jpg|jpeg|gif|gz|zip|flv|rar|wmv|avi|css|swf|png|htc|ico|mpeg|mpg|txt|mp3|mov|js)(?v=[0-9.]+)?$") {
  45. expires 1d;
  46. access_log off;
  47. break;
  48. }
  49. proxy_no_cache $no_cache;
  50. proxy_cache_bypass $no_cache;
  51. proxy_cache TOMCAT;
  52. proxy_cache_key $scheme$host$request_method$request_uri;
  53. proxy_cache_valid 200 302 1s;
  54. proxy_cache_valid 301 1s;
  55. proxy_cache_valid any 1s;
  56. proxy_cache_use_stale updating;
  57. sendfile off;
  58. proxy_pass http://127.0.0.1:8080/;
  59. proxy_redirect default;
  60.  
  61. proxy_set_header Host $host;
  62. proxy_set_header X-Real-IP $remote_addr;
  63. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  64. proxy_max_temp_file_size 0;
  65. add_header X-Cache-Status $upstream_cache_status;
  66. #this is the maximum upload size
  67. client_max_body_size 10m;
  68. client_body_buffer_size 128k;
  69.  
  70. proxy_connect_timeout 90;
  71. proxy_send_timeout 90;
  72. proxy_read_timeout 90;
  73.  
  74. proxy_buffer_size 4k;
  75. proxy_buffers 4 32k;
  76. proxy_busy_buffers_size 64k;
  77. proxy_temp_file_write_size 64k;
  78. }
  79. }
  80.  
  81. server {
  82. server_name *.xyz.com;
  83. listen 443;
  84.  
  85. ssl on;
  86. ssl_session_timeout 5m;
  87. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  88. #make sure you already have this certificate pair!
  89. ssl_certificate /etc/ssl/certs/xyz.crt;
  90. ssl_certificate_key /etc/ssl/certs/xyz.key;
  91. ssl_session_cache shared:SSL:10m;
  92.  
  93. location / {
  94. set $no_cache "";
  95. if ($request_method !~ ^(GET|HEAD)$) {
  96. set $no_cache "1";
  97. }
  98. if ($no_cache = "1") {
  99. add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";
  100. add_header X-Microcachable "0";
  101. }
  102. if ($http_cookie ~* "_mcnc") {
  103. set $no_cache "1";
  104. }
  105. if ($request_uri ~* ".(jpg|jpeg|gif|gz|zip|flv|rar|wmv|avi|css|swf|png|htc|ico|mpeg|mpg|txt|mp3|mov|js)(?v=[0-9.]+)?$") {
  106. expires 1d;
  107. access_log off;
  108. break;
  109. }
  110. proxy_no_cache $no_cache;
  111. proxy_cache_bypass $no_cache;
  112. proxy_cache TOMCAT;
  113. proxy_cache_key $scheme$host$request_method$request_uri;
  114. proxy_cache_valid 200 302 1s;
  115. proxy_cache_valid 301 1s;
  116. proxy_cache_valid any 1s;
  117. proxy_cache_use_stale updating;
  118.  
  119. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  120. proxy_set_header Host $http_host;
  121. proxy_set_header X-Forwarded-Proto https;
  122. add_header X-Cache-Status $upstream_cache_status;
  123. proxy_redirect off;
  124. proxy_connect_timeout 240;
  125. proxy_send_timeout 240;
  126. proxy_read_timeout 240;
  127. # note, there is not SSL here! plain HTTP is used
  128. proxy_pass http://127.0.0.1:8081;
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement