From a07cfd330c349273af343e82fb8581d6bcfc849e Mon Sep 17 00:00:00 2001 From: jfederico Date: Thu, 8 Apr 2021 14:38:03 -0400 Subject: cleaned up nginx --- data/proxy/nginx/default/html/index.html | 25 -------------- data/proxy/nginx/nginx.conf | 37 --------------------- data/proxy/nginx/sites-common | 13 ++++++++ data/proxy/nginx/sites-enabled/.keep | 0 data/proxy/nginx/sites.template.scalelite-proxy | 43 +++++++++---------------- docker-compose-dev.yml | 10 +++--- 6 files changed, 33 insertions(+), 95 deletions(-) delete mode 100644 data/proxy/nginx/default/html/index.html delete mode 100644 data/proxy/nginx/nginx.conf create mode 100644 data/proxy/nginx/sites-common delete mode 100644 data/proxy/nginx/sites-enabled/.keep diff --git a/data/proxy/nginx/default/html/index.html b/data/proxy/nginx/default/html/index.html deleted file mode 100644 index 2ca3b95..0000000 --- a/data/proxy/nginx/default/html/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - -Welcome to nginx! - - - -

Welcome to nginx!

-

If you see this page, the nginx web server is successfully installed and -working. Further configuration is required.

- -

For online documentation and support please refer to -nginx.org.
-Commercial support is available at -nginx.com.

- -

Thank you for using nginx.

- - diff --git a/data/proxy/nginx/nginx.conf b/data/proxy/nginx/nginx.conf deleted file mode 100644 index 981c619..0000000 --- a/data/proxy/nginx/nginx.conf +++ /dev/null @@ -1,37 +0,0 @@ -user nginx; -worker_processes 1; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; - - ## - # Virtual Host Configs - ## - - include /etc/nginx/sites-enabled/*; -} diff --git a/data/proxy/nginx/sites-common b/data/proxy/nginx/sites-common new file mode 100644 index 0000000..d906992 --- /dev/null +++ b/data/proxy/nginx/sites-common @@ -0,0 +1,13 @@ +proxy_read_timeout 60s; +proxy_redirect off; + +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; + +proxy_http_version 1.1; +proxy_set_header Upgrade $http_upgrade; +proxy_set_header Connection "upgrade"; diff --git a/data/proxy/nginx/sites-enabled/.keep b/data/proxy/nginx/sites-enabled/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/data/proxy/nginx/sites.template.scalelite-proxy b/data/proxy/nginx/sites.template.scalelite-proxy index 64462f2..3dca79a 100644 --- a/data/proxy/nginx/sites.template.scalelite-proxy +++ b/data/proxy/nginx/sites.template.scalelite-proxy @@ -37,39 +37,28 @@ server { #ssl_certificate /etc/ssl/fullchain.pem; #ssl_certificate_key /etc/ssl/privkey.pem; - location /bigbluebutton/api/ { + location /health_check { proxy_pass http://docker-scalelite-api; + include /etc/nginx/sites-common; + } - proxy_read_timeout 60s; - proxy_redirect off; - - 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; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + location /bigbluebutton/api/ { + proxy_pass http://docker-scalelite-api; + include /etc/nginx/sites-common; } - location / { + location /presentation { proxy_pass http://docker-scalelite-recordings; + include /etc/nginx/sites-common; + } - proxy_read_timeout 60s; - proxy_redirect off; - - 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 /playback { + proxy_pass http://docker-scalelite-recordings; + include /etc/nginx/sites-common; + } - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + location / { + proxy_pass http://docker-scalelite-api/health_check; + include /etc/nginx/sites-common; } } diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 7418f0d..a356e14 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -53,15 +53,13 @@ services: entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" scalelite-proxy: - image: nginx:latest + image: nginx:1.18 container_name: scalelite-proxy restart: unless-stopped volumes: - ./data/proxy/nginx/log/:/var/log/nginx - - ./data/proxy/nginx/nginx.conf:/etc/nginx/nginx.conf - - ./data/proxy/nginx/sites-enabled:/etc/nginx/sites-enabled - - ./data/proxy/nginx/sites.template.${DOCKER_PROXY_NGINX_TEMPLATE:-scalelite-proxy}:/etc/nginx/sites-available/sites.template - - ./data/proxy/nginx/default/html/:/var/www/html + - ./data/proxy/nginx/sites.template.${DOCKER_PROXY_NGINX_TEMPLATE:-scalelite-proxy}:/etc/nginx/sites.template + - ./data/proxy/nginx/sites-common:/etc/nginx/sites-common - ./data/certbot/conf/:/etc/letsencrypt - ./data/certbot/www/:/var/www/certbot ports: @@ -73,7 +71,7 @@ services: - certbot - scalelite-api - scalelite-recordings - command: /bin/bash -c "envsubst '$$NGINX_HOSTNAME' < /etc/nginx/sites-available/sites.template > /etc/nginx/sites-enabled/sites.conf && exec nginx -g 'daemon off;'" + command: /bin/bash -c "envsubst '$$NGINX_HOSTNAME' < /etc/nginx/sites.template > /etc/nginx/conf.d/sites.conf && exec nginx -g 'daemon off;'" logging: driver: journald -- cgit v1.2.3