install nginx & supervisor on ub

2018-05-13  本文已影响0人  LFBuildMountain

nginx

sudo apt-get update
sudo apt-get install nginx

If a W: GPG error: http://nginx.org/packages/ubuntu xenial Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY $key is encountered during the NGINX repository update, execute the following:

## Replace $key with the corresponding $key from your GPG error.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key
sudo apt-get update
sudo apt-get install nginx

supervisor

sudo apt-get supervisor

//restart superviosr
service supervisor restart

new programs are given to supervisor by configuration file, inform supervisor which executable file is, the path variable of it, how to handle the output

configuration file for programs is in etc/supervisor/conf.d directory, each program has each corresponding configuration file eg: long_script.conf file

// program name 
[program:long_script]
// path to executable file
command=/usr/local/bin/long.sh
// auto start when system boot
autostart=true
// auto restart when program stop due to errors
autorestart=true
// output  file location
stderr_logfile=/var/log/long.err.log
stdout_logfile=/var/log/long.out.log
// let supervisor reread configuration file in etc/supervisor/conf.d directory
systemctl reread
//enact changes
systemctl update

manage program

$systemctl 
long_script                      RUNNING    pid 12614, uptime 1:49:37
supervisor>help

default commands (type help ):
==============================
add    clear  fg        open  quit    remove  restart   start   stop  update
avail  exit   maintail  pid   reload  reread  shutdown  status  tail  version
supervisor> stop long_script
long_script: stopped
supervisor> start long_script
long_script: started
supervisor> restart long_script
long_script: stopped
long_script: started
supervisor> status
long_script                      STOPPED    Jul 21 01:07 AM
//quit supervisor
supervisor> quit
上一篇 下一篇

猜你喜欢

热点阅读