version: '3.8'
networks:
stack-tier:
services:
webserver:
image: nginx:alpine
container_name: nginx
restart: always
tty: true
ports:
- target: 80
published: 80
protocol: tcp
#mode: host
- target: 443
published: 443
protocol: tcp
#mode: host
networks:
- stack-tier
volumes:
- ~/nginx/log/:/var/log/nginx:rw
- ~/nginx/.htpasswd:/etc/nginx/conf.d/.htpasswd:ro
- ~/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- /etc/letsencrypt/:/etc/letsencrypt:ro
- nginx_cache:/var/www:rw
deploy:
placement:
constraints:
- "node.role==manager"
....
upstream site {
server express:8020;
keepalive 60;
}
server {
server_name domain.ru;
return 301 $scheme://www.domain.ru$request_uri;
}
log_format custom '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$gzip_ratio"';
gzip_static on;
#sendfile on;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gunzip on;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/png image/svg+xml image/x-icon image/jpeg font/woff font/woff2;
# cache
proxy_cache_path /var/www levels=1:2 keys_zone=_cache:3m max_size=100m inactive=10m;
proxy_temp_path /var/www/tmp;
server {
listen 443 ssl http2;
server_name domain.ru;
ssl_certificate /etc/letsencrypt/live/domain.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/domain.ru/chain.pem;
access_log /var/log/nginx/domain.ru.access.log custom;
error_log /var/log/nginx/domain.ru.error.log info;
location / {
auth_basic "Restricted area";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
proxy_redirect off;
proxy_pass http://express;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:443;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Proto https;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_cache _cache;
proxy_cache_key "$host|$request_uri";
proxy_cache_valid 200 301 302 304 5m;
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_use_stale error timeout invalid_header http_500 http_502 http_503 http_504;
}
location ~ ^/(images|css|js|fonts|files)/ {
proxy_pass http://express;
access_log off;
expires 365d;
}
location ~* \.(woff|jpg|jpeg|png|gif|ico|css|js|mp4)$ {
access_log off;
}
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nAllow: /\n";
}
}
detectPeaks(data) {
let peaksPrepare, res = []
_.chunk(data, data.length / 150 ).forEach( _slice => {
peaksPrepare.push( _.maxBy(_slice, function(i){ return i[1]}) )
})
_.chunk(peaksPrepare, 15).forEach( _slice => {
res.push( _.maxBy(_slice, function(i){ return i[1]}) )
})
return res
},
что же не так с TUN ?