Advertisement
EpicCDN

nginx conf c

Oct 29th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 4.29 KB | None | 0 0
  1. # For more information on configuration, see:
  2. #   * Official English Documentation: http://nginx.org/en/docs/
  3. #   * Official Russian Documentation: http://nginx.org/ru/docs/
  4.  
  5. user nginx;
  6. worker_processes  8;
  7. worker_rlimit_nofile 100000;
  8.  
  9. #error_log  /var/log/nginx/error.log;
  10. error_log  /var/log/nginx/error.log  notice;
  11. #error_log  /var/log/nginx/error.log  info;
  12.  
  13. pid        /var/run/nginx.pid;
  14.  
  15.  
  16. events {
  17.     worker_connections 10000; # 1024;
  18.     use epoll;
  19.     multi_accept on;
  20. }
  21.  
  22. http {
  23.     include       /etc/nginx/mime.types;
  24.     default_type  application/octet-stream;
  25.  
  26.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  27.                       '$status $body_bytes_sent "$http_referer" '
  28.                       '"$http_user_agent" "$http_x_forwarded_for"';
  29.  
  30.     access_log  /var/log/nginx/access.log  main;
  31.     # to boost IO on HDD we can disable access logs
  32.     access_log off;
  33.    
  34.     client_max_body_size 100m;
  35.     client_body_buffer_size 50m;
  36.  
  37.     sendfile        on;
  38.     tcp_nopush     on;
  39.     tcp_nodelay on;
  40.  
  41.     #keepalive_timeout  0;
  42.     keepalive_timeout  150;
  43.     keepalive_requests 100000;
  44.     reset_timedout_connection on;
  45.  
  46.     open_file_cache max=1000 inactive=20s;
  47.     open_file_cache_valid 10s;
  48.     open_file_cache_min_uses 2;
  49.     open_file_cache_errors on;
  50.  
  51.     gzip  on;
  52.     gzip_vary on;
  53.     gzip_proxied any;
  54.     gzip_comp_level 6;
  55.     gzip_buffers 16 8k;
  56.     gzip_http_version 1.0;
  57.     gzip_disable "MSIE [1-6].(?!.*SV1)";
  58.     gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  59.  
  60.     fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:10m max_size=1000m inactive=60m;
  61.    
  62.     # Load config files from the /etc/nginx/conf.d directory
  63.     # The default server is in conf.d/default.conf
  64.     include /etc/nginx/conf.d/*.conf;
  65.  
  66.     # proxy cache
  67. #    proxy_cache_path  /var/cache/nginx/proxy_cache levels=1:2
  68. #                      keys_zone=czone:32m max_size=256m inactive=1440m;
  69. #    proxy_temp_path   /var/cache/nginx/proxy_temp;
  70. #    proxy_cache_key   "$scheme://$host$request_uri";
  71. #    proxy_set_header  Host               $host;
  72. #    proxy_set_header  X-Real-IP          $remote_addr;
  73. #    proxy_set_header  Remote-Addr        $remote_addr;
  74. #    proxy_set_header  X-Forwarded-Host   $host;
  75. #    proxy_set_header  X-Forwarded-Server $host;
  76. #    proxy_set_header  X-Forwarded-For    $proxy_add_x_forwarded_for;
  77. #    proxy_set_header  Accept-Encoding    "";
  78. #    proxy_set_header  X-UA-Detect        $mobile;
  79. #    proxy_hide_header X-Pingback;
  80. #    proxy_hide_header Link;
  81. #    proxy_hide_header ETag;
  82. #    proxy_connect_timeout 5;
  83. #    proxy_send_timeout 10;
  84. #    proxy_read_timeout 120;
  85. #    proxy_cache_use_stale timeout invalid_header http_500 http_502 http_503 http_504;
  86. #    proxy_cache_lock on;
  87. #    proxy_cache_lock_timeout 5s;
  88.  
  89.     # fastcgi cache
  90.     #fastcgi_cache_path /var/cache/nginx/fastcgi_cache levels=1:2
  91.     #keys_zone=fastcgizone:32m inactive=60m;
  92.     #fastcgi_cache_key "$scheme$request_method$host$request_uri";
  93.     #fastcgi_cache_use_stale error timeout invalid_header http_500;
  94. #    fastcgi_buffers 256 16k;
  95. #    fastcgi_buffer_size 128k;
  96. #    fastcgi_connect_timeout 5s;
  97. #    fastcgi_send_timeout 120s;
  98. #    fastcgi_read_timeout 120s;
  99. #    fastcgi_busy_buffers_size 256k;
  100. #    fastcgi_temp_file_write_size 256k;
  101. #    server_names_hash_bucket_size 100;
  102.  
  103.  
  104.  
  105.    # Retrieves real IP from Cloudflare cache
  106.  
  107.    set_real_ip_from   204.93.240.0/24;
  108.    set_real_ip_from   204.93.177.0/24;
  109.    set_real_ip_from   199.27.128.0/21;
  110.    set_real_ip_from   173.245.48.0/20;
  111.    set_real_ip_from   103.21.244.0/22;
  112.    set_real_ip_from   103.22.200.0/22;
  113.    set_real_ip_from   103.31.4.0/22;
  114.    set_real_ip_from   141.101.64.0/18;
  115.    set_real_ip_from   108.162.192.0/18;
  116.    set_real_ip_from   190.93.240.0/20;
  117.    set_real_ip_from   188.114.96.0/20;  
  118.    set_real_ip_from   197.234.240.0/22;
  119.    set_real_ip_from   198.41.128.0/17;
  120.    set_real_ip_from   162.158.0.0/15;
  121.    #set_real_ip_from   2400:cb00::/32;
  122.    #set_real_ip_from   2606:4700::/32;
  123.    #set_real_ip_from   2803:f800::/32;
  124.    #set_real_ip_from   2405:b500::/32;
  125.    #set_real_ip_from   2405:8100::/32;
  126.    real_ip_header     CF-Connecting-IP;
  127.  
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement