[3]supervisor Use management: Implements an automatic restart of an abnormal interrupt subprocess (for example, Nginx and Apache)

Source: Internet
Author: User
Tags nginx reverse proxy

Installation and configuration of the Web server Nginx uninstall the old version of Nginx
sudo apt-get--purge remove Nginxsudo apt-get autoremovedpkg--get-selections|grep nginx//will list the software related to Nginx, Remove sudo apt-get--prege remove nginx-common1234 as Nginx-common


Installing Nginx
    • Download Nginx from official website

    • Compile and install:


tar -zxvf nginx-1.10.2.tar.gzcd nginx-1.10.2.tar.gz./configure  //Note the information in the terminal, Missing library file Remember to install on re-configure line make    sudo make install12345 


Nginx Reverse proxy configuration
    • Typically a reverse proxy creates a. conf file that is introduced in the master profile nginx.conf

    • Ggyun.conf


server {      listen 8001;         server_name localhost;        charset utf-8;         access_log /home/codemap.access.log;         location / {        proxy_set_header  X-Forwarded-For  $remote _addr</span><span class= "pun" >;</span></code> </li><li class= "L9" ><code><span class= "PLN" >         proxy_set_header </span><span class= "Typ" >host</span><span  class= "PLN" >             $http _host;         proxy_pass http://127.0.0.1:8000;    }} 12345678910
    • Partial configuration in the nginx.conf file

Worker_processes 4;    The number of processes, generally equal to the number of computer CPU cores events {Worker_connections 1024;//maximum number of links}http {//config file root include mime.types;    Default_type Application/octet-stream;    Sendfile on;    #tcp_nopush on;    #keepalive_timeout 0;    Keepalive_timeout 65;    #gzip on; The configuration file introduced by include codemap.conf;//}1234567891011121314
Common commands
Restart nginx:/usr/local/nginx/sbin/nginx-s reopen1 Reload config file:/uar/local/nginx/sbin/nginx-s reload 1 start:/uar/local/nginx/ SBIN/NGINX1 off:/uar/local/nginx/sbin/nginx-s STOP1
Process Management Tools Supervisor Installation
    • The server can be managed with supervisor when running a process and can be run automatically in the background.

Terminal installation
Apt-get Install Supervisor1
Supervisor Configuration
[program:ggyun]directory = /home/noah/documents/src/github.com/hivenkay/ggyun  // Project Path command = /home/noah/documents/src/github.com/hivenkay/ggyun/ggyun  // Executable binary file path autostart = true  //whether the braking start autorestart=true  //automatically restarts startsecs =  5user = root  //Execute User redirect_stderr = truestdout_logfile = /var/ log/supervisord/ggyun.logstderr_logfile =/var/log/supervisord/ghost_err.log12345678910 


Supervisor Common Commands
Supervisorctl start ggyun//Start process 1supervisorctl Restart ggyun//Restart process 1supervisorctl Reload//Restart SUPERVISORCTL1
Supervisor problems that may occur after installation
    • Supervisorctl Start Ggyun error Unix:///var/run/supervisor.sock no such file

      • Solve

sudo touch/var/run/supervisor.sock1sudo chmod 777/var/run/supervisor.sock1sudo service Supervisor Restart1
Connecting to a remote server
    • Windows system Please install Putty,linux system can be directly linked in the terminal

SSH [email protected]//root for username, 139.196.180.208 for server ip1
    • Copying local files to the server

scp/home/noah/documents/... [Email protected]:/home/noah/documents/...


[3]supervisor Use management: Implements an automatic restart of an abnormal interrupt subprocess (for example, Nginx and Apache)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.