SHARE
TWEET

Untitled

a guest Jul 25th, 2017 183 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Server globals
  2. user                    nginx;
  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_comp_level     9;
  54.     gzip_min_length     512;
  55.     gzip_buffers        8 64k;
  56.     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;
  57.     gzip_proxied        any;
  58.     gzip_disable        "MSIE [1-6]\.";
  59.  
  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   199.27.128.0/21;
  75.     set_real_ip_from   173.245.48.0/20;
  76.     set_real_ip_from   103.21.244.0/22;
  77.     set_real_ip_from   103.22.200.0/22;
  78.     set_real_ip_from   103.31.4.0/22;
  79.     set_real_ip_from   141.101.64.0/18;
  80.     set_real_ip_from   108.162.192.0/18;
  81.     set_real_ip_from   190.93.240.0/20;
  82.     set_real_ip_from   188.114.96.0/20;  
  83.     set_real_ip_from   197.234.240.0/22;
  84.     set_real_ip_from   198.41.128.0/17;
  85.     set_real_ip_from   162.158.0.0/15;
  86.     set_real_ip_from   104.16.0.0/12;
  87.     set_real_ip_from   172.64.0.0/13;
  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.     real_ip_header     CF-Connecting-IP;
  94.  
  95.  
  96.     # SSL PCI Compliance
  97.     ssl_session_cache   shared:SSL:10m;
  98.     ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
  99.     ssl_prefer_server_ciphers on;
  100.     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";
  101.  
  102.  
  103.     # Error pages
  104.     error_page          403          /error/403.html;
  105.     error_page          404          /error/404.html;
  106.     error_page          502 503 504  /error/50x.html;
  107.  
  108.  
  109.     # Cache settings
  110.     proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
  111.     proxy_cache_key "$host$request_uri $cookie_user";
  112.     proxy_temp_path  /var/cache/nginx/temp;
  113.     proxy_ignore_headers Expires Cache-Control;
  114.     proxy_cache_use_stale error timeout invalid_header http_502;
  115.     proxy_cache_valid any 1d;
  116.  
  117.  
  118.     # Cache bypass
  119.     map $http_cookie $no_cache {
  120.         default 0;
  121.         ~SESS 1;
  122.         ~wordpress_logged_in 1;
  123.     }
  124.  
  125.  
  126.     # File cache settings
  127.     open_file_cache          max=10000 inactive=30s;
  128.     open_file_cache_valid    60s;
  129.     open_file_cache_min_uses 2;
  130.     open_file_cache_errors   off;
  131.  
  132.    
  133.  
  134.     # Wildcard include
  135.     include             /etc/nginx/conf.d/*.conf;
  136. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top