Add nginx Unit as a supported installation #5928

Closed
opened 2025-12-29 19:34:20 +01:00 by adam · 11 comments
Owner

Originally created by @jeremystretch on GitHub (Jan 11, 2022).

Change Type

Addition

Area

Installation instructions

Proposed Changes

I'm opening this to explore interest in adding nginx Unit as an officially supported installation choice for NetBox. Unit would function as the reverse proxy WSGI/ASGI server, replacing nginx & Gunicorn in the currently recommended installation. Here's a minimal example showing Unit configuration for Django. netbox-docker uses Unit as well.

Adopting Unit as the recommended installation path should simplify the installation docs a bit. However, I'm hesitant to exclude nginx/Apache entirely; maybe these would be moved to an "alternate installations" section?

Originally created by @jeremystretch on GitHub (Jan 11, 2022). ### Change Type Addition ### Area Installation instructions ### Proposed Changes I'm opening this to explore interest in adding [nginx Unit](https://unit.nginx.org/) as an officially supported installation choice for NetBox. Unit would function as the reverse proxy WSGI/ASGI server, replacing nginx & Gunicorn in the currently recommended installation. Here's a [minimal example](https://unit.nginx.org/howto/django/) showing Unit configuration for Django. [netbox-docker](https://github.com/netbox-community/netbox-docker) uses Unit as well. Adopting Unit as the recommended installation path should simplify the installation docs a bit. However, I'm hesitant to exclude nginx/Apache entirely; maybe these would be moved to an "alternate installations" section?
adam added the type: documentationpending closurestatus: under review labels 2025-12-29 19:34:20 +01:00
adam closed this issue 2025-12-29 19:34:20 +01:00
Author
Owner

@hagbarddenstore commented on GitHub (Jan 11, 2022):

Given that nginx Unit isn’t a part of the major distros repos, I recommend against having it as the primary installation method.

I guess it depends on how you structure the documentation, but the path of least resistance would be nginx or Apache.

On 11 Jan 2022, at 22:03, Jeremy Stretch @.***> wrote:


Change Type

Addition

Area

Installation instructions

Proposed Changes

I'm opening this to explore interest in adding nginx Unit as an officially supported installation choice for NetBox. Unit would function as the reverse proxy WSGI/ASGI server, replacing nginx & Gunicorn in the currently recommended installation. Here's a minimal example showing Unit configuration for Django. netbox-docker uses Unit as well.

Adopting Unit as the recommended installation path should simplify the installation docs a bit. However, I'm hesitant to exclude nginx/Apache entirely; maybe these would be moved to an "alternate installations" section?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.

@hagbarddenstore commented on GitHub (Jan 11, 2022): Given that nginx Unit isn’t a part of the major distros repos, I recommend against having it as the primary installation method. I guess it depends on how you structure the documentation, but the path of least resistance would be nginx or Apache. > On 11 Jan 2022, at 22:03, Jeremy Stretch ***@***.***> wrote: > >  > Change Type > > Addition > > Area > > Installation instructions > > Proposed Changes > > I'm opening this to explore interest in adding nginx Unit as an officially supported installation choice for NetBox. Unit would function as the reverse proxy WSGI/ASGI server, replacing nginx & Gunicorn in the currently recommended installation. Here's a minimal example showing Unit configuration for Django. netbox-docker uses Unit as well. > > Adopting Unit as the recommended installation path should simplify the installation docs a bit. However, I'm hesitant to exclude nginx/Apache entirely; maybe these would be moved to an "alternate installations" section? > > — > Reply to this email directly, view it on GitHub, or unsubscribe. > Triage notifications on the go with GitHub Mobile for iOS or Android. > You are receiving this because you are subscribed to this thread.
Author
Owner

@jeremystretch commented on GitHub (Jan 11, 2022):

Pinging @tobiasge & @cimnine to see if they have any feedback/suggestions from their experience with netbox-docker.

@jeremystretch commented on GitHub (Jan 11, 2022): Pinging @tobiasge & @cimnine to see if they have any feedback/suggestions from their experience with netbox-docker.
Author
Owner

@kkthxbye-code commented on GitHub (Jan 11, 2022):

It's very basic, but works if you don't need anything fancy. Stuff like URL rewriting is just not there for example (https://github.com/netbox-community/netbox-docker/issues/650).

Development seem fairly slow on it, and it not being in any repos is not great if the only documented option. It seems like you just want to add it as an alternative option in the documentation though and in that case I have no objections.

@kkthxbye-code commented on GitHub (Jan 11, 2022): It's very basic, but works if you don't need anything fancy. Stuff like URL rewriting is just not there for example (https://github.com/netbox-community/netbox-docker/issues/650). Development seem fairly slow on it, and it not being in any repos is not great if the only documented option. It seems like you just want to add it as an alternative option in the documentation though and in that case I have no objections.
Author
Owner

@tobiasge commented on GitHub (Jan 11, 2022):

We moved the Docker image to Nginx Unit because we had a setup where we had to copy the static files between the Gunicorn and Nginx containers at runtime. That cause many problems, that are now gone.
I really like Unit because it serves the dynamic and static content in one place. We have a working configuration in our repository which can be used.
Personally I use Nginx Unit in multiple project and think it is a good system. I our company we are using the Netbox Docker image for about 150 users (in Openshift). This is really working well.

There is one caveat that needs to be mentioned: Unit doesn't support URL rewriting (yet). That will cause problems with setups where a BASEPATH is needed. But I think think it's not a bit problem as there's a workaround with copying the static files in a subdirectory named after the path.

I've not used the TLS capabilities of Unit yet, but in tests they seemed to work fine.

In conclusion I think Nginx Unit is a good application server.

@tobiasge commented on GitHub (Jan 11, 2022): We moved the Docker image to Nginx Unit because we had a setup where we had to copy the static files between the Gunicorn and Nginx containers at runtime. That cause many problems, that are now gone. I really like Unit because it serves the dynamic and static content in one place. We have a working [configuration](https://github.com/netbox-community/netbox-docker/blob/release/docker/nginx-unit.json) in our repository which can be used. Personally I use Nginx Unit in multiple project and think it is a good system. I our company we are using the Netbox Docker image for about 150 users (in Openshift). This is really working well. There is one caveat that needs to be mentioned: Unit doesn't support URL rewriting (yet). That will cause problems with setups where a `BASEPATH` is needed. But I think think it's not a bit problem as there's a workaround with copying the static files in a subdirectory named after the path. I've not used the TLS capabilities of Unit yet, but in tests they seemed to work fine. In conclusion I think Nginx Unit is a good application server.
Author
Owner

@cimnine commented on GitHub (Jan 12, 2022):

To our users we suggest to do configurations like TLS and all the other magic one needs to have outside of Nginx Unit. Personally I like Caddy to do such, but there are plenty of good web servers out there that can do reverse proxying and rewrite requests and all these extras that users might want.

It's not much different than the currently proposed NetBox setup, where Nginx is used to do most of the magic things, but one would not realy do that in Gunicorn.

The actual benefit of Nginx Unit for us – as explained by Tobias – is that Nginx Unit also serves these static files for us, which was not the case with Gunicorn.

@cimnine commented on GitHub (Jan 12, 2022): To our users we suggest to do configurations like TLS and all the other _magic_ one needs to have outside of Nginx Unit. Personally I like Caddy to do such, but there are plenty of good web servers out there that can do reverse proxying and rewrite requests and all these extras that users might want. It's not much different than the currently proposed NetBox setup, where Nginx is used to do most of the _magic_ things, but one would not realy do that in Gunicorn. The actual benefit of Nginx Unit for us – as explained by Tobias – is that Nginx Unit also serves these static files for us, which was not the case with Gunicorn.
Author
Owner

@ziggekatten commented on GitHub (Jan 12, 2022):

We have been running within Docker/Kubernetes in production since 2.x, and use relative paths (Traefik ingress), and we are still use traditional nginx, since Unit causes some issues serving static content. I see no reason to go the Unit route.

Also, Unit does not support dynamic reloading when developin for example Custom Scripts.

@ziggekatten commented on GitHub (Jan 12, 2022): We have been running within Docker/Kubernetes in production since 2.x, and use relative paths (Traefik ingress), and we are still use traditional nginx, since Unit causes some issues serving static content. I see no reason to go the Unit route. Also, Unit does not support dynamic reloading when developin for example Custom Scripts.
Author
Owner

@kkthxbye-code commented on GitHub (Jan 12, 2022):

Also, Unit does not support dynamic reloading when developin for example Custom Scripts.

This is not correct. Custom scripts are loaded each request in the view code and works fine with nginx unit. If it is not working, something else is wrong with your setup.

@kkthxbye-code commented on GitHub (Jan 12, 2022): > Also, Unit does not support dynamic reloading when developin for example Custom Scripts. This is not correct. Custom scripts are loaded each request in the view code and works fine with nginx unit. If it is not working, something else is wrong with your setup.
Author
Owner

@ziggekatten commented on GitHub (Jan 13, 2022):

Also, Unit does not support dynamic reloading when developin for example Custom Scripts.

This is not correct. Custom scripts are loaded each request in the view code and works fine with nginx unit. If it is not working, something else is wrong with your setup.

Well, none of our developers have got this to work, neither by using the supplied Docker compose, nor an tweaked setup. The only way is to run commands towards the API of Unit, which is a mess doing local development.

@ziggekatten commented on GitHub (Jan 13, 2022): > > Also, Unit does not support dynamic reloading when developin for example Custom Scripts. > > This is not correct. Custom scripts are loaded each request in the view code and works fine with nginx unit. If it is not working, something else is wrong with your setup. Well, none of our developers have got this to work, neither by using the supplied Docker compose, nor an tweaked setup. The only way is to run commands towards the API of Unit, which is a mess doing local development.
Author
Owner

@tobiasge commented on GitHub (Jan 13, 2022):

Nginx Unit is meant as a production server like Gunicorn. For development you should use the integrated Django manage.py runserver.

@tobiasge commented on GitHub (Jan 13, 2022): Nginx Unit is meant as a production server like Gunicorn. For development you should use the integrated Django `manage.py runserver`.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 15, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Mar 15, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@jeremystretch commented on GitHub (Mar 17, 2022):

It doesn't seem like there's any tangible motivation to move toward Unit at this time. We might revisit this in the future but I'm going to close this out for now.

@jeremystretch commented on GitHub (Mar 17, 2022): It doesn't seem like there's any tangible motivation to move toward Unit at this time. We might revisit this in the future but I'm going to close this out for now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5928