TEXT   163
use nginx worker processes auto
Guest on 28th November 2024 07:08:04 AM


  1. user nginx;
  2. worker_processes auto;
  3. timer_resolution   100ms;
  4. worker_rlimit_nofile 2048;
  5.  
  6. error_log /var/log/nginx/error.log info;
  7.  
  8. events {
  9.         worker_connections  512;
  10.         use epoll;
  11. }
  12.  
  13. http {
  14.         include         /etc/nginx/mime.types;
  15.         default_type    application/octet-stream;
  16.  
  17.         log_format main
  18.                 '$remote_addr - $remote_user [$time_local] '
  19.                 '"$request" $status $bytes_sent '
  20.                 '"$http_referer" "$http_user_agent" ';
  21.  
  22.  
  23.         gzip on;
  24.         gzip_min_length 4096;
  25.         gzip_buffers    16 8k;
  26.         gzip_types text/css text/xml application/xml application/x-javascript application/javascript text/javascript text/plain;
  27.  
  28.         sendfile        on;
  29.         tcp_nopush      on;
  30.         tcp_nodelay     on;
  31.  
  32.         # Simple anti-DDoS protection, part 1, limiting the timeouts and buffer sizes:
  33.         client_header_timeout      5;
  34.         client_body_timeout        5;
  35.         send_timeout               5;
  36.         keepalive_timeout          10;
  37.         reset_timedout_connection  on;
  38.      
  39.         # Required on aarch64 (a1 and m6g AWS instances):
  40.         #server_names_hash_bucket_size 64;
  41.  
  42.         large_client_header_buffers 4 16k;
  43.         client_max_body_size          32m;
  44.  
  45.         # Protect against a bug in IE 10&11, http://habrahabr.ru/company/pt/blog/249809/ :
  46.         add_header X-Frame-Options SAMEORIGIN;
  47.  
  48.         # Hide the version of nginx from hackers:
  49.         server_tokens off;
  50.  
  51.         # Simple anti-DDoS protection, part 2.1, limiting the number of connection and requests per IP address:
  52.         limit_req_zone $binary_remote_addr zone=reqsperip:16m rate=4r/s;
  53.         limit_conn_zone $binary_remote_addr zone=connsperip:16m;
  54.  
  55.         # Simple anti-DDoS protection, part 4, beating off the bots that do not send  Host: headers
  56.         server {
  57.                listen *:80;
  58.                server_name  noname;
  59.                return  444;
  60.         }
  61.  
  62.         server {
  63.                 listen          *:80;
  64.                 server_name     localhost;
  65.                 access_log      /var/log/nginx/pma.log main;
  66.                 index           index.php  index.html;
  67.                 root            /www/pma;
  68.  
  69.                 # Simple anti-DDoS protection, part 2.2a, maximum 8 connections per source IP:
  70.                 limit_conn connsperip 8;
  71.  
  72.                 location / { try_files $uri $uri/ /index.php$is_args$args; }
  73.  
  74.                 location ~ \.php$ {
  75.                   # Simple anti-DDoS protection, part 2.2b, maximum 12 requests to PHP scripts per source IP:
  76.                   limit_req zone=reqsperip burst=12 nodelay;
  77.                   fastcgi_pass   127.0.0.1:59038;
  78.                   fastcgi_buffer_size   16k;
  79.                   fastcgi_busy_buffers_size  16k;
  80.                   include        fastcgi_params;
  81.                   fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  82.                 }
  83.  
  84.                 include static.conf;
  85.         }
  86. }

Raw Paste

Login or Register to edit or fork this paste. It's free.