the-paperless-project / paperless

Scan, index, and archive all of your paper documents
GNU General Public License v3.0
7.84k stars 501 forks source link

Problem pulling static content with reverse proxy #697

Open AlexKalopsia opened 3 years ago

AlexKalopsia commented 3 years ago

I am running Paperless on my server and I am trying to setup remote access (https://paperless.mydomain.com) to it via reverse proxy. I get it to work, but Paperless fails to load the static files (ie all CSS).

I've bashed into the container and used ./manage.py collectstatic. I confirm I can see all the static files on my paperless/static mounted folder.

Docker-compose

version: "3"
services:

  paperless-webserver:
    container_name: paperless-webserver
    image: thepaperlessproject/paperless:latest
    ports:
      - "4444:8000"
    env_file:
      - /volume1/docker/.env
    environment:
      - PAPERLESS_OCR_LANGUAGES=eng ita swe nld bul
      - PAPERLESS_PASSPHRASE=${PAPER_PSW}
      - PAPERLESS_USE_SSL=true
      - USERMAP_UID=1000
      - USERMAP_GID=1000
      - TZ=${TZ}
    volumes:
      - /volume1/docker/paperless/data:/usr/src/paperless/data
      - /volume1/docker/paperless/media:/usr/src/paperless/media
      - /volume1/docker/paperless/consume:/consume
      - /volume1/docker/paperless/export:/export
      - /volume1/docker/paperless/static:/usr/src/paperless/static
    command: ["runserver", "--insecure", "--noreload", "0.0.0.0:8000"]
    restart: unless-stopped

  paperless-consumer:
    container_name: paperless-consumer
    image: thepaperlessproject/paperless:latest
    environment:
      - PAPERLESS_OCR_LANGUAGES=eng ita swe nld bul
      - PAPERLESS_PASSPHRASE=${PAPER_PSW}
      - PAPERLESS_USE_SSL=true
      - USERMAP_UID=1000
      - USERMAP_GID=1000
      - TZ=${TZ}
    tmpfs:
      - /tmp
    depends_on:
      - paperless-webserver
    volumes:
      - /volume1/docker/paperless/data:/usr/src/paperless/data
      - /volume1/docker/paperless/media:/usr/src/paperless/media
      - /volume1/docker/paperless/consume:/consume
      - /volume1/docker/paperless/export:/export
    command: ["document_consumer"]
    restart: unless-stopped

nginx:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name papers.*;

    include /config/nginx/ssl.conf;

    index index.html index.htm index.php;
    access_log /config/log/nginx/paperless_access.log;
    error_log /config/log/nginx/paperless_error.log;

    location /static {
        autoindex on;
        alias /volume1/docker/paperless/static;
    }

    location / {
        include /config/nginx/proxy.conf;
        proxy_pass http://192.168.1.200:4444;
    }
}

I can't understand why all the static files return 404. File permissions seem ok. Any idea?

Thank you