diff --git a/docker-compose.yml b/docker-compose.yml index d2cdbb8..800c16f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +version: '3.8' + services: frontend: build: @@ -21,15 +23,16 @@ services: - ./backend:/app - sqlite_data:/app/instance ports: - - "8081:8000" + - "8000:8000" nginx: build: - context: ./docker/nginx + context: . + dockerfile: docker/nginx/Dockerfile container_name: support-nginx restart: unless-stopped ports: - - "8080:80" + - "80:80" depends_on: - frontend - backend diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile index 6831bc8..046d742 100644 --- a/docker/nginx/Dockerfile +++ b/docker/nginx/Dockerfile @@ -1,17 +1,7 @@ FROM nginx:alpine -# Create required directories -RUN mkdir -p /var/cache/nginx \ - /var/cache/nginx/client_temp \ - /var/cache/nginx/proxy_temp \ - /var/cache/nginx/fastcgi_temp \ - /var/cache/nginx/uwsgi_temp \ - /var/cache/nginx/scgi_temp \ - /var/run - -# Copy configuration files -COPY conf.d/default.conf /etc/nginx/conf.d/ -COPY nginx.conf /etc/nginx/ +COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf +COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf index baffc3b..9b15ba9 100644 --- a/docker/nginx/conf.d/default.conf +++ b/docker/nginx/conf.d/default.conf @@ -5,32 +5,15 @@ server { root /usr/share/nginx/html; index index.html; - # Основной маршрут для статических файлов - location / { - try_files $uri $uri/ /index.html; - add_header Cache-Control "no-cache, no-store, must-revalidate"; - } - - # Маршрут для админ-панели - location /admin { - alias /usr/share/nginx/html; - try_files $uri $uri/ /index.html; - add_header Cache-Control "no-cache, no-store, must-revalidate"; - } - - # API прокси location /api/ { - proxy_pass http://backend:8000/api/; - proxy_http_version 1.1; + proxy_pass http://backend:8000; 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_connect_timeout 60s; - proxy_send_timeout 60s; - proxy_read_timeout 60s; } - # Обработка ошибок - error_page 404 /index.html; -} + location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file