Single-container approach (nginx + php-fpm 8.3 + supervisord) to match web.hhivp.com deployment paradigm (host nginx → docker по порту). - Dockerfile: builder (node:22-alpine npm ci+next build) → runtime (php:8.3-fpm-alpine) - docker/nginx.conf: serves static from /var/www/sag24.ru/public_html, fastcgi_pass на 127.0.0.1:9000 - docker/supervisord.conf: запускает php-fpm + nginx - docker-compose.yml: для деплоя на web в /opt/docker/sites/sag24-ru/, mount contact-config.php read-only - .dockerignore: исключает node_modules/.git/out из контекста Container exposes :8080 (бесроутовый bind), маппится на host :4070 на web. Watchtower label включён (auto-deploy на изменения образа в registry).
63 lines
1.6 KiB
Nginx Configuration File
63 lines
1.6 KiB
Nginx Configuration File
worker_processes auto;
|
|
error_log /dev/stderr warn;
|
|
pid /run/nginx/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
keepalive_timeout 30;
|
|
server_tokens off;
|
|
|
|
# Доверять X-Forwarded-For от host nginx на web (loopback proxy).
|
|
set_real_ip_from 127.0.0.1/32;
|
|
set_real_ip_from 172.16.0.0/12;
|
|
real_ip_header X-Forwarded-For;
|
|
real_ip_recursive on;
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] '
|
|
'"$request" $status $body_bytes_sent '
|
|
'"$http_referer" "$http_user_agent"';
|
|
access_log /dev/stdout main;
|
|
|
|
gzip on;
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
gzip_min_length 1024;
|
|
gzip_vary on;
|
|
|
|
server {
|
|
listen 8080 default_server;
|
|
server_name _;
|
|
|
|
root /var/www/sag24.ru/public_html;
|
|
index index.html;
|
|
|
|
# Старые URL без локали → /ru/
|
|
rewrite ^/uslugi(/.*)?$ /ru/uslugi$1 redirect;
|
|
|
|
location ~ ^/api/.*\.php$ {
|
|
try_files $uri =404;
|
|
fastcgi_pass 127.0.0.1:9000;
|
|
fastcgi_index contact.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
location / {
|
|
try_files $uri $uri/ $uri/index.html =404;
|
|
}
|
|
}
|
|
}
|