Advertisement
matinfo

general nginx conf

Mar 12th, 2019
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.66 KB | None | 0 0
  1. user  www-data;
  2. worker_processes  8;
  3. worker_rlimit_nofile 100000;
  4.  
  5. pid        /var/run/nginx.pid;
  6.  
  7. events {
  8.     worker_connections  1024;
  9.     multi_accept on;
  10.     use epoll;
  11. }
  12.  
  13. http   {
  14.     index         index.html index.php;
  15.     include       /etc/nginx/mime.types;
  16.     default_type  application/octet-stream;
  17.    
  18.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" ';
  19.     log_format  error403  '$remote_addr - [$time_local] "$request"';                     
  20.    
  21.     keepalive_timeout   5; 
  22.     server_tokens       off;
  23.     port_in_redirect    off;
  24.     sendfile            on;
  25.     tcp_nopush          on;
  26.     tcp_nodelay         on;
  27.    
  28.     ## Flood protection example
  29.     limit_req_zone $binary_remote_addr zone=search:25m rate=1r/s;
  30.     limit_req_zone $binary_remote_addr zone=account:25m rate=1r/s;
  31.     limit_req_zone $binary_remote_addr zone=checkout:25m rate=1r/s;
  32.    
  33.     ## Cache open FD
  34.     open_file_cache max=10000 inactive=3600s;
  35.     open_file_cache_valid 7200s;
  36.     open_file_cache_min_uses 2;
  37.    
  38.     ## Gzipping is an easy way to reduce page weight
  39.     gzip                          on;
  40.     gzip_disable             "msie6";
  41.     gzip_vary                     on;
  42.     gzip_http_version            1.0;
  43.     gzip_comp_level                6;
  44.     gzip_min_length             1100;
  45.     gzip_buffers               16 8k;
  46.     gzip_types  text/plain text/xml application/xml application/xml+rss application/atom+xml image/svg+xml font/opentype application/x-font-ttf application/vnd.ms-fontobject text/css text/javascript application/javascript application/x-javascript application/json
  47.     gzip_proxied  expired no-cache no-store private auth;
  48.     gzip_static                   on;
  49.  
  50.     # Proxy global options
  51.     proxy_buffering              off;
  52.     proxy_cache_min_uses           3;
  53.     proxy_cache_path  /etc/nginx/proxy_temp/ levels=1:2 keys_zone=cache:10m inactive=10m max_size=1000M;
  54.     #proxy_cache_valid        any 1m;
  55.  
  56.     proxy_ignore_client_abort    off;
  57.     proxy_intercept_errors        on;
  58.     proxy_next_upstream  error timeout invalid_header;
  59.  
  60.     proxy_redirect               off;
  61.  
  62.     proxy_set_header  X-Forwarded-For $remote_addr;
  63.     proxy_connect_timeout         60;
  64.     proxy_send_timeout            60;
  65.     proxy_read_timeout            60;
  66.  
  67.    
  68.     ## Use when Varnish in front
  69.     #set_real_ip_from 127.0.0.1;
  70.     #real_ip_header X-Forwarded-For;
  71.    
  72.     ## Map status to exclude from access log
  73.     map $status $writelog { 404  0; 410  0; 444  0; default 1; }
  74.    
  75.     ## Main domain configuration
  76.     include /etc/nginx/sites-enabled/*.conf;
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement