Nginx as Reverse Proxy for multiple servers binded to proxy using UNIX sockets - how to reached in LAN

Reinis Rozitis r at
Mon Oct 22 08:50:11 UTC 2018

> 2. command line
> Slowly I being understanding reading Starting, Stopping, and Restarting NGINX and Controlling NGINX Processes at Runtime. If you run 
> multiple instances you use the signal -s with a reference to the desired PID otherwise it will pick the default on what is /var/run/ , 
> isn't?
> e.g. I have a master and two user nginx instances relaoding each of them would be:
> master: nginx -s reload 
> user1:  nginx -s reload "pid /var/run/"
> user2:  nginx -s reload "pid /var/run/"
> Making sure that I understood correctly  nginx -g "pid /var/run/; worker_processes `sysctl -n hw.ncpu`;" means to replace the 
> number of workers by the count of CPUs in nginx master process with the process id given in /var/run/, doesn't it?

While you can specify the pid (process id) from the command line imo it's more simple to put  the pid file directive in each nginx configuration ( ). For example nginx_user1.conf could have pid logs/; , nginx_user2.conf  - pid logs/; etc.. 

Then for the cli commands you can just specify particular configuration file and nginx will pick up the pid automatically. For example to reload user2 nginx instance the cli command would be:
nginx -s reload -c /path/to/user2_nginx.conf


More information about the nginx mailing list