Advertisement
Guest User

Untitled

a guest
Aug 1st, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.28 KB | None | 0 0
  1. cat > /etc/nginx/nginx.conf <<NGX
  2. user www-data;
  3. pid /run/nginx.pid;
  4.  
  5.   # you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
  6.   worker_processes auto; #some last versions calculate it automatically
  7.  
  8.   # number of file descriptors used for nginx
  9.   # the limit for the maximum FDs on the server is usually set by the OS.
  10.   # if you don't set FD's then OS settings will be used which is by default 2000
  11.   worker_rlimit_nofile 100000;
  12.  
  13.   # Ubuntu 18.04 and Debian 9 requires the fancyindex module to be loaded
  14.   load_module "modules/ngx_http_fancyindex_module.so";
  15.  
  16. events {
  17.   worker_connections 1024;
  18.   multi_accept on;
  19.   use epoll;
  20. }
  21.  
  22. http {
  23.  
  24.   ##
  25.   # Basic Settings
  26.   ##
  27.  
  28.   #sendfile on;
  29.   #tcp_nopush on;
  30.   #tcp_nodelay on;
  31.   #keepalive_timeout 65;
  32.   types_hash_max_size 2048;
  33.   server_tokens off;
  34.  
  35.   # server_names_hash_bucket_size 64;
  36.   # server_name_in_redirect off;
  37.   include /etc/nginx/mime.types;
  38.   default_type application/octet-stream;
  39.  
  40.   # cache informations about FDs, frequently accessed files
  41.   # can boost performance, but you need to test those values
  42.   #open_file_cache max=200000 inactive=20s;
  43.   #open_file_cache_valid 30s;
  44.   #open_file_cache_min_uses 2;
  45.   #open_file_cache_errors on;
  46.  
  47.   ##
  48.   # SSL Settings
  49.   ##
  50.   ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
  51.   ssl_prefer_server_ciphers on;
  52.  
  53.   ##
  54.   # Logging Settings
  55.   ##
  56.   access_log off;
  57.   error_log /var/log/nginx/error.log crit;
  58.  
  59.   # copies data between one FD and other from within the kernel
  60.   # faster then read() + write()
  61.   sendfile on;
  62.  
  63.   # send headers in one peace, its better then sending them one by one
  64.   tcp_nopush on;
  65.  
  66.   # don't buffer data sent, good for small data bursts in real time
  67.   tcp_nodelay on;
  68.  
  69.   ##
  70.   # Gzip Settings
  71.   ##
  72.   gzip on;
  73.   gzip_disable "msie6";
  74.   gzip_vary on;
  75.   gzip_proxied expired no-cache no-store private auth;
  76.   gzip_min_length 1024;
  77.   gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  78.  
  79.   #gzip on; - enables gzip compression
  80.   #gzip_vary on: - tells proxies to cache both gzipped and regular versions of a resource
  81.   #gzip_min_length 1024; - informs NGINX to not compress anything smaller than the defined size
  82.   #gzip_proxied - compress data even for clients that are connecting via proxies (here we're enabling compression if: a response header includes the "expired", "no-cache", "no-store", "private", and "Authorization" parameters)
  83.   #gzip_types - enables the types of files that can be compressed
  84.   #gzip_disable "MSIE [1-6]\."; - disable compression for Internet Explorer versions 1-6
  85.  
  86.   # allow the server to close connection on non responding client, this will free up memory
  87.   reset_timedout_connection on;
  88.  
  89.   # request timed out -- default 60
  90.   client_body_timeout 10;
  91.  
  92.   # if client stop responding, free up memory -- default 60
  93.   send_timeout 2;
  94.  
  95.   # server will close connection after this time -- default 75
  96.   keepalive_timeout 30;
  97.  
  98.   # number of requests client can make over keep-alive -- for testing environment
  99.   #keepalive_requests 100000;
  100.  
  101.   ##
  102.   # Virtual Host Configs
  103.   ##
  104.  
  105.   include /etc/nginx/conf.d/*.conf;
  106.   include /etc/nginx/sites-enabled/*;
  107. }
  108. NGX
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement