Рецепты Nginx
API Gateway config
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name api-totaling.maxc.name;
gzip on;
gzip_types text/plain application/xml text/css application/javascript;
gzip_min_length 1000;
access_log /var/log/nginx/access_api-totaling.maxc.name.log;
location /api/auth/ {
proxy_pass http://127.0.0.1:3011; # manager.totaling
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
location /api/manager/ {
expires $expires;
proxy_redirect off;
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-Proto $scheme;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass http://127.0.0.1:3011; # manager.totaling
}
location /api/manager/socket.io {
proxy_pass http://127.0.0.1:3011;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
# location ~* \.(jpg|jpeg|gif|png|ico|css|js|html|txt|bmp|swf) {
# root /var/www/api-totaling.maxc.name/;
# }
ssl_certificate /etc/letsencrypt/live/api-totaling.maxc.name/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/api-totaling.maxc.name/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}