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

Reinis Rozitis r at roze.lv
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/nginx.pid , 
> 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/nginx_user1.pid"
> user2:  nginx -s reload "pid /var/run/nginx_user2.pid"
> 
> Making sure that I understood correctly  nginx -g "pid /var/run/nginx.pid; 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/nginx.pid, 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 ( http://nginx.org/en/docs/ngx_core_module.html#pid ). For example nginx_user1.conf could have pid logs/nginx_user1.pid; , nginx_user2.conf  - pid logs/nginx_user2.pid; 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

rr 



More information about the nginx mailing list