Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container does not serve static assets when proxied through Nginx #91

Closed
dabaer opened this issue May 11, 2021 · 2 comments
Closed

Container does not serve static assets when proxied through Nginx #91

dabaer opened this issue May 11, 2021 · 2 comments

Comments

@dabaer
Copy link

dabaer commented May 11, 2021

linuxserver.io

When proxied through Nginx, static assets are not available, and return 404 in the browser.


Expected Behavior

Static assets should load when directly proxied with nginx.

Current Behavior

They do not load.

Steps to Reproduce

  1. Run the mariadb and bookstack containers with the documented example
  2. Point nginx to it with proxy_pass.
  3. Profit
  4. ?

Environment

OS: Ubuntu 20.04
CPU architecture: x86_64
How docker service was installed: From the docker repo, via docker run.

Command used to create docker container (run/create/compose/screenshot)

docker run -d \
  --name=bookstack \
  -e APP_URL=<my custom url which is correct> \
  -e DB_HOST=mariadb \
  -e DB_USER=bookstack \
  -e DB_PASS=12345 \
  -e DB_DATABASE=bookstack \
  -p 6875:80 \
  -v /var/lib/dockerdata/bookstack:/config \
  --restart unless-stopped \
  --network=bookstack \
  ghcr.io/linuxserver/bookstack

Docker logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 
usermod: no changes

-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \ 
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/


Brought to you by linuxserver.io
-------------------------------------

To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------

User uid:    911
User gid:    911
-------------------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing... 
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing... 
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
........................................+++++
...................................................................+++++
writing new private key to '/config/keys/cert.key'
-----
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing... 
Generating BookStack app key for first run
App Key set to base64:<snip>= you can modify the file to update /config/BOOKSTACK_APP_KEY.txt
Running config - db_user set
**** APP_URL in /config/www/.env is being updated from https://example.com to <my custom url which is correct> ****
**** If this is an existing install, you should run the following line from your host terminal to update the database URL entries: ****
************************************************************************
docker exec -it bookstack php /var/www/html/artisan bookstack:update-url https://example.com <my custom url which is correct>
************************************************************************
/var/run/s6/etc/cont-init.d/50-config: line 86: warning: command substitution: ignored null byte in input
/var/run/s6/etc/cont-init.d/50-config: line 86: warning: command substitution: ignored null byte in input
Nothing to migrate.
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

Nginx Configuration

server {
  listen 444 ssl http2;
  listen [::]:444 ssl http2;

  server_name kb.rcscartage.ca;

  # SSL Config here

  add_header Strict-Transport-Security max-age=15768000;

  location ~* \.(js|css|png|jp?g|gif|ico)$ {
      expires 1M;
      add_header Cache-Control public;
  }

  location / {
    proxy_redirect off;
    proxy_pass http://127.0.0.1:6875;
  }

  location ^~ /.well-known/acme-challenge/ {
    default_type "text/plain";
    root         /var/www/;
  }

  location = /.well-known/acme-challenge/ {
    return 404;
  }
}

I have tried setting the index and root settings. I also tried exposing /var/www/html/public to the host, however when doing so the container refused to write any files there. (I did see it correctly writes when not mounted with docker exec bookstack ls /var/www/html/public).

@github-actions
Copy link

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

@tobbenb
Copy link
Member

tobbenb commented May 11, 2021

It works using our proxy config in swag, so check that out and adjust yours.
https://github.com/linuxserver/reverse-proxy-confs/blob/master/bookstack.subdomain.conf.sample

This isn't a bug so if you want help, jump on our discord server and ask in the correct channel.
https://linuxserver.io/support

@tobbenb tobbenb closed this as completed May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants