diff --git a/back b/back index 4539302..812e30a 160000 --- a/back +++ b/back @@ -1 +1 @@ -Subproject commit 453930251bf5980b6a07e9f8399ed67eb6e7d77c +Subproject commit 812e30a2f89992fe1dabeea52eddea8646bd0c21 diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf index a1dacf6..6ba6ed8 100644 --- a/config/nginx/nginx.conf +++ b/config/nginx/nginx.conf @@ -1,38 +1,67 @@ -upstream backned { - server unix:/app/run/socket.sock; +proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=7d use_temp_path=off; + +upstream backend +{ + server unix:/app/run/socket0.sock; + server unix:/app/run/socket1.sock; + server unix:/app/run/socket2.sock; + server unix:/app/run/socket3.sock; } -upstream frontend { - server front:3000; +upstream frontend +{ + server front:3000; } +server +{ + listen 80; server_name crm.logidex.ru; + gzip on; + gzip_proxied any; + gzip_comp_level 4; + gzip_types text/css application/javascript image/svg+xml application/json text/plain text/xml; -server { - listen 80; - server_name crm.logidex.ru; + # Общие proxy_set_header, унаследованные всеми location + 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 Host $host; - location /api { - proxy_pass http://backned; - proxy_set_header Host $http_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; + location /api + { + proxy_pass http://backend; + } + + location / + { + proxy_pass http://frontend; + } + + location /_next/webpack-hmr + { + proxy_pass http://frontend; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location /_next/static + { + proxy_cache STATIC; + proxy_pass http://frontend; + add_header X-Cache-Status $upstream_cache_status; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_cache_bypass $http_upgrade; } - location / { - proxy_pass http://frontend; - proxy_set_header Host $http_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; - } - - location /_next/webpack-hmr { - proxy_pass http://frontend; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $host; - } + location /static + { + proxy_cache STATIC; + proxy_ignore_headers Cache-Control; + proxy_cache_valid 60m; + proxy_pass http://frontend; + } } \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index fa2900c..d077fab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,6 @@ services: restart: unless-stopped front: image: git.logidex.ru/fakz9/crm-frontend:latest - depends_on: - - back env_file: - config/front/.env networks: @@ -25,6 +23,7 @@ services: - "443:443" depends_on: - back + - front volumes: - type: bind source: ./config/nginx/nginx.conf diff --git a/front b/front index cd034bc..1047a0b 160000 --- a/front +++ b/front @@ -1 +1 @@ -Subproject commit cd034bcce652ded9df9a71860b8b0b8dc9c99d69 +Subproject commit 1047a0b5fe106375e053e761627babae4fa88590