Advertisement
ValeryAV

Оптимизированный nginx.config

Apr 1st, 2019
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.37 KB | None | 0 0
  1.  
  2. user  nginx;
  3. worker_processes  2;
  4.  
  5. error_log  /var/log/nginx/error.log warn;
  6. pid        /var/run/nginx.pid;
  7.  
  8.  
  9. events {
  10.     worker_connections  2048;
  11. }
  12.  
  13.  
  14. http {
  15.     include       /etc/nginx/mime.types;
  16.     default_type  application/octet-stream;
  17.  
  18.     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
  19.                       '$status $body_bytes_sent "$http_referer" '
  20.                       '"$http_user_agent" "$http_x_forwarded_for"';
  21.  
  22.     #access_log  /var/log/nginx/access.log  main;
  23.     access_log off;
  24.  
  25.     proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=all:32m max_size=1g;
  26.  
  27.     sendfile        on;
  28.     #tcp_nopush     on;
  29.  
  30.     keepalive_timeout  65;
  31.  
  32.     gzip on;
  33.     gzip_disable "msie6";
  34.     gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
  35.  
  36.     include /etc/nginx/conf.d/*.conf;
  37.    
  38.     server {
  39.         listen 80;
  40.  
  41.         location / {
  42.                 proxy_pass http://127.0.0.1:81/;
  43.                 proxy_cache all;
  44.                 proxy_cache_valid 404 502 503 1m;
  45.                 proxy_cache_valid any 1h;
  46.         }
  47.     }
  48.  
  49.     server {
  50.         listen 81;
  51.  
  52.         location / {
  53.             root /data/www;
  54.         }
  55.  
  56.         location /images/ {
  57.             root /data;
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement