Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. # Server globals
  2. user www-data;
  3. worker_processes auto;
  4. worker_rlimit_nofile 65535;
  5. error_log /var/log/nginx/error.log crit;
  6. pid /var/run/nginx.pid;
  7.  
  8.  
  9. # Worker config
  10. events {
  11. worker_connections 1024;
  12. use epoll;
  13. multi_accept on;
  14. }
  15.  
  16.  
  17. http {
  18. # Main settings
  19. sendfile on;
  20. tcp_nopush on;
  21. tcp_nodelay on;
  22. client_header_timeout 1m;
  23. client_body_timeout 1m;
  24. client_header_buffer_size 2k;
  25. client_body_buffer_size 256k;
  26. client_max_body_size 256m;
  27. large_client_header_buffers 4 8k;
  28. send_timeout 30;
  29. keepalive_timeout 60 60;
  30. reset_timedout_connection on;
  31. server_tokens off;
  32. server_name_in_redirect off;
  33. server_names_hash_max_size 512;
  34. server_names_hash_bucket_size 512;
  35.  
  36.  
  37. # Log format
  38. log_format main '$remote_addr - $remote_user [$time_local] $request '
  39. '"$status" $body_bytes_sent "$http_referer" '
  40. '"$http_user_agent" "$http_x_forwarded_for"';
  41. log_format bytes '$body_bytes_sent';
  42. #access_log /var/log/nginx/access.log main;
  43. access_log off;
  44.  
  45.  
  46. # Mime settings
  47. include /etc/nginx/mime.types;
  48. default_type application/octet-stream;
  49.  
  50.  
  51. # Compression
  52. gzip on;
  53. gzip_vary on;
  54. gzip_comp_level 9;
  55. gzip_min_length 512;
  56. gzip_buffers 8 64k;
  57. gzip_types text/plain text/css text/javascript text/js text/xml application/json application/javascript application/x-javascript application/xml application/xml+rss application/x-font-ttf image/svg+xml font/opentype;
  58. gzip_proxied any;
  59. gzip_disable "MSIE [1-6]\.";
  60.  
  61. # Proxy settings
  62. proxy_redirect off;
  63. proxy_set_header Host $host;
  64. proxy_set_header X-Real-IP $remote_addr;
  65. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  66. proxy_pass_header Set-Cookie;
  67. proxy_connect_timeout 90;
  68. proxy_send_timeout 90;
  69. proxy_read_timeout 90;
  70. proxy_buffers 32 4k;
  71.  
  72.  
  73. # Cloudflare https://www.cloudflare.com/ips
  74. set_real_ip_from 103.21.244.0/22;
  75. set_real_ip_from 103.22.200.0/22;
  76. set_real_ip_from 103.31.4.0/22;
  77. set_real_ip_from 104.16.0.0/12;
  78. set_real_ip_from 108.162.192.0/18;
  79. set_real_ip_from 131.0.72.0/22;
  80. set_real_ip_from 141.101.64.0/18;
  81. set_real_ip_from 162.158.0.0/15;
  82. set_real_ip_from 172.64.0.0/13;
  83. set_real_ip_from 173.245.48.0/20;
  84. set_real_ip_from 188.114.96.0/20;
  85. set_real_ip_from 190.93.240.0/20;
  86. set_real_ip_from 197.234.240.0/22;
  87. set_real_ip_from 198.41.128.0/17;
  88. #set_real_ip_from 2400:cb00::/32;
  89. #set_real_ip_from 2606:4700::/32;
  90. #set_real_ip_from 2803:f800::/32;
  91. #set_real_ip_from 2405:b500::/32;
  92. #set_real_ip_from 2405:8100::/32;
  93. #set_real_ip_from 2c0f:f248::/32;
  94. #set_real_ip_from 2a06:98c0::/29;
  95. real_ip_header CF-Connecting-IP;
  96.  
  97.  
  98. # SSL PCI Compliance
  99. ssl_session_cache shared:SSL:10m;
  100. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  101. ssl_prefer_server_ciphers on;
  102. ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
  103.  
  104.  
  105. # Error pages
  106. error_page 403 /error/403.html;
  107. error_page 404 /error/404.html;
  108. error_page 502 503 504 /error/50x.html;
  109.  
  110.  
  111. # Cache settings
  112. proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
  113. proxy_cache_key "$host$request_uri $cookie_user";
  114. proxy_temp_path /var/cache/nginx/temp;
  115. proxy_ignore_headers Expires Cache-Control;
  116. proxy_cache_use_stale error timeout invalid_header http_502;
  117. proxy_cache_valid any 1d;
  118.  
  119.  
  120. # Cache bypass
  121. map $http_cookie $no_cache {
  122. default 0;
  123. ~SESS 1;
  124. ~wordpress_logged_in 1;
  125. }
  126.  
  127.  
  128. # File cache settings
  129. open_file_cache max=10000 inactive=30s;
  130. open_file_cache_valid 60s;
  131. open_file_cache_min_uses 2;
  132. open_file_cache_errors off;
  133.  
  134.  
  135. # Wildcard include
  136. include /etc/nginx/conf.d/*.conf;
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement