How to run multiple nginx master processes

I want to run multiple nginx master processes at boot time, based on
this
script Ubuntu Upstart | NGINX.

There are some variables at the top and I’d like to know if changing
those
variables will make it successful.

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx

PS=“nginx”
PIDNAME=“nginx” #lets you do $PS-slave
PIDFILE=$PIDNAME.pid #pid file
PIDSPATH=/var/run

DESCRIPTION=“Nginx Server…”

RUNAS=root #user to run as

SCRIPT_OK=0 #ala error codes
SCRIPT_ERROR=1 #ala error codes
TRUE=1 #boolean
FALSE=0 #boolean

lockfile=/var/lock/subsys/nginx
NGINX_CONF_FILE=“/usr/local/nginx/conf/nginx.conf”

Of these the most likely ones are

PS=“nginx” #own comment - it is used to
reference the running process in killall etc
# I wonder if symlinking the
nginx binary and using that will stop the code
# from breaking
# it appears to be used for
locating the running process, and I suspect if it is not
#changed it will interfere
with the default proces
# hopefully nginx daemon does
use hardcoded references to its own name for
# process management

PIDNAME=“nginx” #own comment - obvious need to avoid default
binary
PIDFILE=$PIDNAME.pid #own comment - changed by
changing PIDNAME

PIDSPATH=/var/run # own comment - no need

DESCRIPTION=“Nginx Server…” # own comment - can be
changed, but looks harmless

RUNAS=root # own comment - this can be
changed for a particular user

SCRIPT_OK=0 #own comment - no need - ala
error codes
SCRIPT_ERROR=1 #own comment - no need - ala
error codes
TRUE=1 #own comment - no need - boolean
FALSE=0 #own comment - no need - boolean

lockfile=/var/lock/subsys/nginx #own comment = has to be
different from default process
NGINX_CONF_FILE=“/usr/local/nginx/conf/nginx.conf” #own comment -
clearly needs to be different

Any opinions, has anyone tried it before?

/vfclists

It seems to be more OS-specific than nginx-specific, have you asked in
the Ubuntu forums? Why would you want to run two masters?!

Unless nginx does a check to see if another nginx is running (by .pid
file?, so at least that you’d have to change in the script), i guess
you should be safe using two different server configuration files
(i.e. different listening ports and domains).

HTH
Nuno


Mars 2 Stay!

/etc