add docker readme nginx
This commit is contained in:
81
nginx.external.example.conf
Normal file
81
nginx.external.example.conf
Normal file
@@ -0,0 +1,81 @@
|
||||
# Пример конфигурации внешнего Nginx (reverse proxy)
|
||||
# Для использования перед docker-compose стеком
|
||||
#
|
||||
# Скопируйте в /etc/nginx/sites-available/eng-bot.conf
|
||||
# и создайте симлинк: ln -s /etc/nginx/sites-available/eng-bot.conf /etc/nginx/sites-enabled/
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name your-domain.com www.your-domain.com;
|
||||
|
||||
# Редирект на HTTPS
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name your-domain.com www.your-domain.com;
|
||||
|
||||
# SSL сертификаты (Let's Encrypt)
|
||||
ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
|
||||
|
||||
# SSL настройки
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_prefer_server_ciphers off;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 1d;
|
||||
|
||||
# Gzip сжатие
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
# Логи
|
||||
access_log /var/log/nginx/eng-bot.access.log;
|
||||
error_log /var/log/nginx/eng-bot.error.log;
|
||||
|
||||
# Проксирование на docker-compose стек (порт 3001)
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3001;
|
||||
proxy_http_version 1.1;
|
||||
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_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Таймауты
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
# Опционально: закрыть доступ к статистике извне
|
||||
# location /stats/ {
|
||||
# allow 192.168.0.0/16;
|
||||
# allow 10.0.0.0/8;
|
||||
# deny all;
|
||||
#
|
||||
# proxy_pass http://127.0.0.1:3001;
|
||||
# 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;
|
||||
# }
|
||||
|
||||
# Опционально: Basic Auth для /stats/
|
||||
# location /stats/ {
|
||||
# auth_basic "Statistics";
|
||||
# auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
#
|
||||
# proxy_pass http://127.0.0.1:3001;
|
||||
# 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;
|
||||
# }
|
||||
}
|
||||
Reference in New Issue
Block a user