commit 603fbdab27e7f98964cc7935010b839116112c1c Author: Chika Date: Thu Dec 1 15:48:59 2022 +0300 init diff --git a/.env b/.env new file mode 100644 index 0000000..052cf31 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +URL_DOWNLOAD= \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..66a6d41 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + internal_server: + image: nginx + volumes: + - ./nginx.conf:/etc/nginx/templates/default.conf.template + restart: always + environment: + - URL_DOWNLOAD=${URL_DOWNLOAD} + networks: + - internal_network + +networks: + internal_network: diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..1c71783 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,52 @@ + +worker_processes 4; + +events { + worker_connections 1024; +} + +upstream auth_server { + server auth_server:80; +} + + +http { + server { + listen 80; + + gzip on; + gzip_min_length 1000; + gzip_proxied any; + gzip_comp_level 1; + gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; + gzip_vary on; + gzip_disable "msie6"; + + include /etc/nginx/mime.types; + + # AUTHENTICATION + error_page 401 /login; + + location = /auth { + internal; + + proxy_pass http://auth_server; + + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; + proxy_set_header X-Original-Remote-Addr $remote_addr; + proxy_set_header X-Original-Host $host; + } + + location ~ ^/(login|signin|logout|get-user) { + proxy_pass http://auth_server; + } + + + location /download { + auth_request /auth; + proxy_pass $URL_DOWNLOAD; + } + } +} \ No newline at end of file