Hello,
I have an Nginx server running on Debian Trixie, as a "user" systemd
service. It is working, but if I have 100 users, I don't want to spawn
100 nginx servers just for waiting for connections.
Each nginx instance "listen" on a unix socket in /run/user directory.
I tried sockets triggering, and while the log is working, triggering
the nginx server fails, because the socket is already opened.
Is there a better way to achieve this, i.e. spawning nginx instance on
demand ?
Andre Rodier (HE12026-05-31):Yes, I can use a search engine too, found the same kind of results, and they're not really helpful.
Hello,
I have an Nginx server running on Debian Trixie, as a "user" systemd
service. It is working, but if I have 100 users, I don't want to spawn
100 nginx servers just for waiting for connections.
Each nginx instance "listen" on a unix socket in /run/user directory.
I tried sockets triggering, and while the log is working, triggering
the nginx server fails, because the socket is already opened.
Is there a better way to achieve this, i.e. spawning nginx instance on
demand ?
First hit on a web search about ?nginx systemd socket activation?:
https://www.freedesktop.org/wiki/Software/systemd/DaemonSocketActivation/
Not tested it.
But if you need to start 100 instances of nginx and are looking how to achieve it, you probably have an XY problem where you mistakenly assumed
you need 100 instances of nginx to achieve your real goal. But you have
not share your real goal.
Regards,
First hit on a web search about ?nginx systemd socket activation?:
On Sun May 31, 2026 at 6:42 PM BST, Nicolas George wrote:
But if you need to start 100 instances of nginx and are looking how to achieve it, you probably have an XY problem where you mistakenly assumed you need 100 instances of nginx to achieve your real goal. But you have
not share your real goal.
- I have one nginx instance, running as a system systemd service, usng basic authentication (on pam).
- I have nginx user instances for each user (used as webdav servers)
~~~
proxy_pass http://unix:/var/tmp/webdav-user/$remote_user/socket;
root /home/$remote_user/webdav/root;
autoindex on;
~~~
I tested the socket activation, and the systemd logic is working, i.e.
it is calling the user systemd service. BUT, the user service fails to
start, because the socket is own by systemd.
Yes, I can use a search engine too, found the same kind of results, and they're not really helpful.
I can detail more what I have so far, then.
- I have one nginx instance, running as a system systemd service, usng basic authentication (on pam).
- I have nginx user instances for each user (used as webdav servers)
- The system server uses proxy_pass directive to dispatch queries to each user?s nginx instance.
I tested the socket activation, and the systemd logic is working, i.e. it is calling the user systemd service.
BUT, the user service fails to start, because the socket is own by systemd.
so can these be used to create the socket with ownership of user and read/write to system nginx?
Andy Smith (HE12026-05-31):Yes, it is not permissions. Here is the exact error message:
so can these be used to create the socket with ownership of user and
read/write to system nginx?
Maybe let us ask for the error message before randomly assuming the
issue is caused by permissions.
(My guess is the issue is not caused by permissions.)
Regards,
Andre Rodier (HE12026-05-31):I am using the built-in dav mechanism, I don't think I ever wrote I am using a custom one.
Yes, I can use a search engine too, found the same kind of results, and they're not really helpful.
At this point, what is not really helpful is you saying the results are
not really helpful.
What you should be saying instead is (1) what search result you used,
(2) what you tried exactly and (3) hot it failed.
I can detail more what I have so far, then.
- I have one nginx instance, running as a system systemd service, usng basic authentication (on pam).
- I have nginx user instances for each user (used as webdav servers)
- The system server uses proxy_pass directive to dispatch queries to each user?s nginx instance.
To prove you are not having a XY problem, you need to explain why you
think an instance of nginx per user is preferable to the built-in
mechanism it offers for dav.
Answered in the other threadI tested the socket activation, and the systemd logic is working, i.e. it is calling the user systemd service.
BUT, the user service fails to start, because the socket is own by systemd.
As said above, you need to show exactly what you did and how it failed.
Regards,Same,
~~~
bind() to unix:/run/user/1001/nginx-webdav.socket failed (98: Address already in use)
~~~
I think this behaviour is normal, as the socket is already created by systemd socket file.
My question would be something like ?is there a way to share the socket between systemd and nginx? ?
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 4 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 495146:45:51 |
| Calls: | 165 |
| Files: | 574 |
| D/L today: |
29 files (9,998K bytes) |
| Messages: | 78,216 |