[Nix-dev] Running multiple Apache servers in the same ports

Marc Weber marco-oweber at gmx.de
Sun May 19 19:40:42 CEST 2013


Excerpts from Cai Chen's message of Sun May 19 19:28:08 +0200 2013:
> I am very fascinated by the idea before NixOS: running same package side by
> side in multi-user environment. Same package can be installed and packaged
> into each user's own store path so that they can't interfere with each
> other, however, how can I run it under say port say 80 for Apache server?
Get started - then you'll understad that there is no "each users" store
in the common setups. (You can install into a user directory, and
recompile everything from scratch, but usually you don't want to do this
unless there is a good reason)

Port numbers are system resource, thus without tricks (such as chroots
or such) there will be only one port 80 - and only one application will
be able to listen to it. Thats why for important standard ports you even
have to be root to listen to them (AFAIK).
If you have to serve http by running user applications, such as
domain/user1 domain/user2 the only way is to use fast-cgi, cgi, or http
proxying, eg let user run on port :8081 and forward requests to
domain/user1 to localhost:8081

> This is common requirement or feature found in virtualization technologies
> such as OpenVZ or XEN. 
nix itself is no virtualizing solution. It does try to achieve the same
separation when running builds.
So you can use nix(os) to manage your OpenVZ or XEN clients or start
apache (nixos is using systemd now - as most linux distros are ?)

Marc Weber


More information about the nix-dev mailing list