Netbox - No CSS loading with Apache2 #2769

Closed
opened 2025-12-29 18:21:58 +01:00 by adam · 2 comments
Owner

Originally created by @Minahora on GitHub (Aug 1, 2019).

Python version: 7.0
NetBox version v2.6.1

Hi !
I have finished my installation of netbox, following step by step https://netbox.readthedocs.io/en/stable/

before install the apache server, i ran a test server locally with " python3 manage.py 172.22.76.23:8000 --insecure
that worked ! i have CSS etc.. As u can see :

image

But, when i installed Apache2 and make configuration step by step of https://netbox.readthedocs.io/en/stable/installation/3-http-daemon/

can't read CSS..

image

My config :

/etc/apache2/sites-availables/netbox.conf

`<VirtualHost *:80>
ProxyPreserveHost On

ServerName 172.22.76.23

Alias /static /home/toto/netbox/netbox/static

# Needed to allow token-based API authentication
WSGIPassAuthorization on

<Directory /home/toto/netbox/netbox/static>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Require all granted
</Directory>

<Location /static>
    ProxyPass !
</Location>

RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
ProxyPass / http://172.22.76.23:8001/
ProxyPassReverse / http://172.22.76.23:8001/

`

i create a file in /home/toto/netbox/gunicorn_config.py

command = '/usr/bin/gunicorn'
pythonpath = '/home/toto/netbox/netbox'
bind = '172.22.76.23:8000'
workers = 3
user = 'www-data'

I create a other file for supervisor in /etc/supervisor/conf.d/netbox.conf

`[program:netbox]
command = gunicorn -c /home/toto/netbox/gunicorn_config.py netbox.wsgi
directory = /home/toto/netbox/netbox/
user = www-data

[program:netbox-rqworker]
command = python3 /home/toto/netbox/netbox/manage.py rqworker
directory = /home/toto/netbox/netbox/
user = www-data`

Create a folder static before :

python3 manage.py collectstatic --no-input

So, do u know why ?

Thanks,

Originally created by @Minahora on GitHub (Aug 1, 2019). Python version: 7.0 NetBox version v2.6.1 Hi ! I have finished my installation of netbox, following step by step https://netbox.readthedocs.io/en/stable/ before install the apache server, i ran a test server locally with " python3 manage.py 172.22.76.23:8000 --insecure that worked ! i have CSS etc.. As u can see : ![image](https://user-images.githubusercontent.com/36745437/62276218-d8864f00-b443-11e9-83fd-abebb7622fd7.png) But, when i installed Apache2 and make configuration step by step of https://netbox.readthedocs.io/en/stable/installation/3-http-daemon/ can't read CSS.. ![image](https://user-images.githubusercontent.com/36745437/62276176-bf7d9e00-b443-11e9-86a0-dfb7c1f39bff.png) My config : /etc/apache2/sites-availables/netbox.conf `<VirtualHost *:80> ProxyPreserveHost On ServerName 172.22.76.23 Alias /static /home/toto/netbox/netbox/static # Needed to allow token-based API authentication WSGIPassAuthorization on <Directory /home/toto/netbox/netbox/static> Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted </Directory> <Location /static> ProxyPass ! </Location> RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} ProxyPass / http://172.22.76.23:8001/ ProxyPassReverse / http://172.22.76.23:8001/ </VirtualHost>` i create a file in /home/toto/netbox/gunicorn_config.py ``` command = '/usr/bin/gunicorn' pythonpath = '/home/toto/netbox/netbox' bind = '172.22.76.23:8000' workers = 3 user = 'www-data' ``` I create a other file for supervisor in /etc/supervisor/conf.d/netbox.conf `[program:netbox] command = gunicorn -c /home/toto/netbox/gunicorn_config.py netbox.wsgi directory = /home/toto/netbox/netbox/ user = www-data [program:netbox-rqworker] command = python3 /home/toto/netbox/netbox/manage.py rqworker directory = /home/toto/netbox/netbox/ user = www-data` Create a folder static before : python3 manage.py collectstatic --no-input So, do u know why ? Thanks,
adam closed this issue 2025-12-29 18:21:58 +01:00
Author
Owner

@loganobrien commented on GitHub (Aug 2, 2019):

I ran into the same problem with Nginx. The error.log of Nginx said that it can't find several css and js files in the folder /opt/netbox/netbox/static/rest_framework/ or /opt/netbox/netbox/static/admin/.

But there was the folder called /opt/netbox/netbox/project-static/ so I renamed it to /opt/netbox/netbox/static and it worked. Unfortunately not for the admin sites /admin.

On a different server running an old version of NetBox (v2.5.13), I saw that there is the static folder by default (without renaming them).

@loganobrien commented on GitHub (Aug 2, 2019): I ran into the same problem with Nginx. The `error.log` of Nginx said that it can't find several css and js files in the folder `/opt/netbox/netbox/static/rest_framework/` or `/opt/netbox/netbox/static/admin/`. But there was the folder called `/opt/netbox/netbox/project-static/` so I renamed it to `/opt/netbox/netbox/static` and it worked. Unfortunately not for the admin sites `/admin`. On a different server running an old version of NetBox (v2.5.13), I saw that there is the `static` folder by default (without renaming them).
Author
Owner

@jeremystretch commented on GitHub (Aug 2, 2019):

Thank you for your interest in NetBox. GitHub issues are intended for reporting reproducible bugs and requesting features, and must be submitted using one of the templates provided here. For general discussion, questions, or assistance with installation issues, please post to our mailing list instead.

@jeremystretch commented on GitHub (Aug 2, 2019): Thank you for your interest in NetBox. GitHub issues are intended for reporting reproducible bugs and requesting features, and must be submitted using one of the templates provided [here](https://github.com/digitalocean/netbox/issues/new/choose). For general discussion, questions, or assistance with installation issues, please post to our [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss) instead.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2769