By hungrymind
What I am trying to do is create 5 users for nodejs application development. When they deploy the application, it runs on ip:port but is there anyway to run on ip/user:port? OR can I assign specific port range to specific user so that there won’t be issue of port?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I don’t think you’ll be able to restrict a user to specific ports. However, a common solution here is to use Unix domain sockets (UDS) rather than TCP ports.
For example, if you’re running Nginx on ports 80/443, you’d have your users configure their nodejs apps to each listen on their own Unix domain sockets. Each Unix domain socket has a filesystem path and filesystem permissions, just like files. So, each user would configure their app to listen on a Unix domain socket under their home directory at something like /home/USER/run/app.sock with permissions set so that the socket is readable and writable by Nginx. Then you’d configure Nginx so that it talks to the correct Unix domain socket for each “server” you’ve configured in Nginx (a “server” is what each separate website is called in the Nginx configuration).
For permissions reasons, if you aren’t a filesystem permissions expert, you might have them use a path other than one under their home directory, too. It might be easier to use /var/run/USER/APPNAME.sock and you could make each /var/run/USER directory owned and writeable by USER and readable by the user Nginx runs as. That way, you don’t have to be allowing the Nginx user’s read access under each of your developer’s home directories.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.