Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.56 KB | None | 0 0
  1. user  root root;
  2. worker_processes  auto;
  3. worker_rlimit_nofile  65535;
  4.  
  5. pid        /var/run/nginx.pid;
  6.  
  7. events {
  8.         worker_connections  1024;
  9.         use                 epoll;
  10.         multi_accept        on;
  11. }
  12.  
  13. http {
  14.     # MIME SETTINGS
  15.     include             /etc/nginx/mime.types;
  16.     default_type        application/octet-stream;
  17.  
  18.     # 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            2000M;
  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.     # COMPRESSION
  37.     gzip                on;
  38.     gzip_comp_level     9;
  39.     gzip_min_length     512;
  40.     gzip_buffers        8 64k;
  41.     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;
  42.     gzip_proxied        any;
  43.     gzip_disable        "MSIE [1-6]\.";
  44.  
  45.     # PROXY SETTINGS
  46.     proxy_redirect      off;
  47.     proxy_set_header    Host            $host;
  48.     proxy_set_header    X-Real-IP       $remote_addr;
  49.     proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
  50.     proxy_set_header    GEOIP-COUNTRY-CODE $geoip2_data_country_code;
  51.     proxy_pass_header   Set-Cookie;
  52.     proxy_connect_timeout   90;
  53.     proxy_send_timeout  90;
  54.     proxy_read_timeout  90;
  55.     proxy_buffers       32 4k;
  56.  
  57.     # CACHE SETTINGS
  58.     proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
  59.     proxy_cache_key "$host$request_uri $cookie_user";
  60.     proxy_temp_path  /var/cache/nginx/temp;
  61.     proxy_ignore_headers Expires Cache-Control;
  62.     proxy_cache_use_stale error timeout invalid_header http_502;
  63.     proxy_cache_valid any 1d;
  64.  
  65.     # FILE CACHE SETTINGS
  66.     open_file_cache          max=10000 inactive=30s;
  67.     open_file_cache_valid    60s;
  68.     open_file_cache_min_uses 2;
  69.     open_file_cache_errors   off;
  70.  
  71.     # LOG FORMAT
  72.     log_format  main    '$remote_addr - $remote_user [$time_local] $request '
  73.                         '"$status" $body_bytes_sent "$http_referer" '
  74.                         '"$http_user_agent" "$http_x_forwarded_for"';
  75.     log_format  bytes   '$body_bytes_sent';
  76.     #access_log          /var/log/nginx/access.log main;
  77.     access_log off;
  78.     error_log /var/log/nginx/error.log crit;
  79.  
  80.     # INCLUDE GEOIP COUNTRIES
  81.     geoip2 /usr/src/GeoLite2-Country.mmdb {
  82.             $geoip2_data_country_code country iso_code;
  83.     }
  84.  
  85.     server {
  86.         listen   80 default_server;
  87.         root /var/www/html;
  88.  
  89.         # CLEAN DOUBLE SLASHES
  90.         if ($request_uri ~* "\/\/") {
  91.             rewrite ^/(.*) /$1 permanent;
  92.         }
  93.  
  94.         location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|otf|ttf|eot|woff|woff2|svg)$ {
  95.             access_log off;
  96.             expires 365d;
  97.  
  98.             try_files $uri @proxy;
  99.         }
  100.  
  101.         location / {
  102.             proxy_pass http://10.43.32.18:80;
  103.         }
  104.  
  105.         location @proxy {
  106.             proxy_pass http://10.43.32.18:80;
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement