Assume your deployment is under /netbox
:
Add to configuration/configuration.py
BASE_PATH = environ.get('BASE_PATH', '')
Add to env/netbox.env
BASE_PATH=/netbox
Then merge this with your own docker-compose.override.yml
(or create one if not existed) to make health checker of Docker happy:
version: '3.4'
services:
netbox:
healthcheck:
test: "curl -f http://localhost:8080/netbox/api/ || exit 1"
Outside NGINX config:
upstream netbox {
server 127.0.0.1:8080; # or your own NetBox port
}
server {
listen 80;
location /netbox {
proxy_pass http://netbox;
}
location /netbox/static {
proxy_pass http://netbox/static/;
}
}
The trick is to strip BASE_PATH
on any requests to static resources.
Hi,
I'm having the same issue with Netbox. In previous versions I was able to get a custom context root working by doing what I described here: netbox-community/netbox-docker#650 (comment) but that isnt' working anymore, as I now get constantly redirected to the homepage. Is it possible for you to share your whole nginx-unit.json file? The modifications you talk about here when you say "Outside NGINX config" were done in that file, right? If I try adding something like your example here, my NGINX fails to start, so I'm probably misunderstanding something.
Thanks in advance!