OpenSlides / openslides-docker

Old docker compose and pypi setup for OpenSlides 3.x
MIT License
3 stars 2 forks source link

Modify nginx Template, so static files are loaded correctly #1

Closed jsaalfeld closed 6 years ago

jsaalfeld commented 6 years ago

According to the Big Mode instruction, the nginx-config for OpenSlides should contain some location rewrites, so the nginx itself delivers the static data, instead of the daphnes (web).

jsaalfeld commented 6 years ago

Could be manually achieved by adding the staticfiles volume to the nginx service

      - "staticfiles:/app/static:ro"

The nginx config is already in a volume, so you can go over there and then just replace

    location / {
         proxy_pass https://myserver.de;
    }

with

     location ~* ^/(?!ws|wss|webclient|core/servertime|core/version|users/whoami|users/login|users/logout|users/setpassword|motions/docxtemplate|agenda/docxtemplate|projector|real-projector|static|media|rest).*$ {
         rewrite ^.*$ /static/templates/index.html;
     }
     location ~* ^/projector.*$ {
         rewrite ^.*$ /static/templates/projector-container.html;
     }
     location ~* ^/real-projector.*$ {
         rewrite ^.*$ /static/templates/projector.html;
     }
     location ~* ^/webclient.*$ {
         rewrite ^/webclient/(site|projector).*$ /static/js/webclient-$1.js;
     }
     location /static {
         alias /app/static/var/collected-static;
     }

     location / {
         proxy_pass https://myserver.de;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
         proxy_set_header Host $http_host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Scheme $scheme;
     }

WARNING - THIS WILL BE OVERWRITTEN WHEN CONTAINERS START OR STOP!