作者: admin

  • centos 6.x进程守护者supervisor

    1,下载安装

    supervisor-3.2.0.tar.gz下载 https://pan.baidu.com/s/1kVbpHqv

    tar zxf supervisor-3.2.0.tar.gz
    cd supervisor-3.2.0
    python setup.py install

     

    测试安装是否成功:echo_supervisord_conf 

     

    如果报类似这样的错:

    No local packages or download links found for meld3>=0.6.5
    error: Could not find suitable distribution for Requirement.parse('meld3>=0.6.5')

     

    解决:

    下载meld3部署包:wget https://pypi.python.org/packages/source/m/meld3/meld3-1.0.2.tar.gz
    解压:tar -xvf meld3-1.0.2.tar.gz
    进入解压包:cd meld3-1.0.1.tar.gz
    开始安装:python setup.py install
    

     

     

     

    创建默认的配置文件,为nginx创建进程守护案例:

    echo_supervisord_conf >/etc/supervisord.conf
    vi /etc/supervisord.conf
    ; Sample supervisor config file.
    ;
    ; For more information on the config file, please see:
    ; http://supervisord.org/configuration.html
    ;
    ; Notes:
    ; - Shell expansion ("~" or "$HOME") is not supported. Environment
    ; variables can be expanded using this syntax: "%(ENV_HOME)s".
    ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
    
    ;[unix_http_server]
    ;file=/tmp/supervisor.sock ; (the path to the socket file)
    ;chmod=0700 ; socket file mode (default 0700)
    ;chown=nobody:nogroup ; socket file uid:gid owner
    ;username=user ; (default is no username (open server))
    ;password=123 ; (default is no password (open server))
    
    [inet_http_server] ; inet (TCP) server disabled by default
    port=127.0.0.1:8888 ; (ip_address:port specifier, *:port for all iface)
    username=user ; (default is no username (open server))
    password=123 ; (default is no password (open server))
    
    [supervisord]
    logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
    logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
    logfile_backups=10 ; (num of main logfile rotation backups;default 10)
    loglevel=info ; (log level;default info; others: debug,warn,trace)
    pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    nodaemon=false ; (start in foreground if true;default false)
    minfds=1024 ; (min. avail startup file descriptors;default 1024)
    minprocs=200 ; (min. avail process descriptors;default 200)
    ;umask=022 ; (process file creation umask;default 022)
    ;user=chrism ; (default is current user, required if root)
    ;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
    ;directory=/tmp ; (default is not to cd during start)
    ;nocleanup=true ; (don't clean up tempfiles at start;default false)
    ;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
    ;environment=KEY="value" ; (key value pairs to add to environment)
    ;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
    
    ; the below section must remain in the config file for RPC
    ; (supervisorctl/web interface) to work, additional interfaces may be
    ; added by defining them in separate rpcinterface: sections
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
    ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
    ;username=chris ; should be same as http_username if set
    ;password=123 ; should be same as http_password if set
    ;prompt=mysupervisor ; cmd line prompt (default "supervisor")
    ;history_file=~/.sc_history ; use readline history if available
    
    ; The below sample program section shows all possible program subsection values,
    ; create one or more 'real' program: sections to be able to control them under
    ; supervisor.
    
    ;[program:theprogramname]
    ;command=/bin/cat ; the program (relative uses PATH, can take args)
    ;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
    ;numprocs=1 ; number of processes copies to start (def 1)
    ;directory=/tmp ; directory to cwd to before exec (def no cwd)
    ;umask=022 ; umask for process (default None)
    ;priority=999 ; the relative start priority (default 999)
    ;autostart=true ; start at supervisord start (default: true)
    ;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
    ;startretries=3 ; max # of serial start failures when starting (default 3)
    ;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
    ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
    ;stopsignal=QUIT ; signal used to kill process (default TERM)
    ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
    ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
    ;killasgroup=false ; SIGKILL the UNIX process group (def false)
    ;user=chrism ; setuid to this UNIX account to run the program
    ;redirect_stderr=true ; redirect proc stderr to stdout (default false)
    ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
    ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
    ;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
    ;stdout_events_enabled=false ; emit events on stdout writes (default false)
    ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
    ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    ;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
    ;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
    ;stderr_events_enabled=false ; emit events on stderr writes (default false)
    ;environment=A="1",B="2" ; process environment additions (def no adds)
    ;serverurl=AUTO ; override serverurl computation (childutils)
    
    ; The below sample eventlistener section shows all possible
    ; eventlistener subsection values, create one or more 'real'
    ; eventlistener: sections to be able to handle event notifications
    ; sent by supervisor.
    
    ;[eventlistener:theeventlistenername]
    ;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
    ;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
    ;numprocs=1 ; number of processes copies to start (def 1)
    ;events=EVENT ; event notif. types to subscribe to (req'd)
    ;buffer_size=10 ; event buffer queue size (default 10)
    ;directory=/tmp ; directory to cwd to before exec (def no cwd)
    ;umask=022 ; umask for process (default None)
    ;priority=-1 ; the relative start priority (default -1)
    ;autostart=true ; start at supervisord start (default: true)
    ;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
    ;startretries=3 ; max # of serial start failures when starting (default 3)
    ;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
    ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
    ;stopsignal=QUIT ; signal used to kill process (default TERM)
    ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
    ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
    ;killasgroup=false ; SIGKILL the UNIX process group (def false)
    ;user=chrism ; setuid to this UNIX account to run the program
    ;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
    ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
    ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
    ;stdout_events_enabled=false ; emit events on stdout writes (default false)
    ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
    ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    ;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
    ;stderr_events_enabled=false ; emit events on stderr writes (default false)
    ;environment=A="1",B="2" ; process environment additions
    ;serverurl=AUTO ; override serverurl computation (childutils)
    
    ; The below sample group section shows all possible group values,
    ; create one or more 'real' group: sections to create "heterogeneous"
    ; process groups.
    
    ;[group:thegroupname]
    ;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
    ;priority=999 ; the relative start priority (default 999)
    
    ; The [include] section can just contain the "files" setting. This
    ; setting can list multiple files (separated by whitespace or
    ; newlines). It can also contain wildcards. The filenames are
    ; interpreted as relative to this file. Included files *cannot*
    ; include files themselves.
    
    ;[include]
    ;files = relative/directory/*.ini
    
    
    
    [program:Nginx]
    command=/usr/local/nginx/sbin/nginx
    directory=/usr/local/nginx/
    autostart=true
    autorestart=true
    stderr_logfile=/usr/local/nginx/logs/nginx.err.log
    stdout_logfile=/usr/local/nginx/logs/nginx.out.log
    user=root
    stopsignal=INT
    
    [program:Frps]
    command=/etc/init.d/frps start
    command=sleep 3
    autostart=true
    autorestart=true
    
    

     

    启动

    supervisord -c /etc/supervisord.conf

     

    关闭进程

    ps -ef | grep supervisord
    
    root   2503  1  0 Nov19 ?  00:03:23 /usr/bin/python /usr/bin/supervisord
    root   21337 2556  0 18:15 pts/8   00:00:00 grep --color=auto supervisord
    kill -s SIGTERM 2503  

     

    查看状态supervisorctl status

    启动全部supervisorctl start all

    停止全部supervisorctl stop all

     

    .开启supervisord服务

      # supervisord -c /etc/supervisord.conf

      更新新的配置到supervisord

      # supervisorctl update

      

      重新启动配置中的所有程序

      # supervisorctl reload

      

      启动某个进程(program_name=你配置中写的程序名称)

      # supervisorctl start program_name

      查看正在守候的进程

      # supervisorctl

      重启某一进程 (program_name=你配置中写的程序名称)

      # supervisorctl restart program_name

      停止全部进程

      # supervisorctl stop all

     

    http://www.cnblogs.com/gsblog/p/3730293.html

    http://www.cnblogs.com/weiweictgu/p/5830397.html 

     

     

     

     

  • 解决:wordpress出现“此页面包含重定向循环”的问题

    这两个文件均位于wp_includes文件夹下。首先,对于canonical.php文件的修改,利用文本编辑器打开该文件,开头注释下面就可以找到如下语句:
    1,
    function redirect_canonical( $requested_url = null, $do_redirect = true ) {
    把true修改为false即可。
    2,
    其次,对于template-loader.php文件,打开之后找到如下代码片段:
    if ( defined(‘WP_USE_THEMES’) && WP_USE_THEMES )do_action(‘template_redirect’);
    把这段代码删除或者用PHP的注释符号注释掉即可,你可以用“”多行注释来注释掉此段代码。

    https://www.zhihu.com/question/29350940

  • 推荐:koa2与mongodb交互

    如果是使用mongodb与node.js配合使用,这推荐安装monk模块,不管是koa 2还是express 4.x都推荐使用。

    详细文档:https://automattic.github.io/monk/docs/GETTING_STARTED.html

    安装:

    npm install --save monk

     

    调用:

    const monk = require('monk');
    const url = 'localhost:27017/xgllseo';
    const db = monk(url);

     

    创建唯一索引自动递增:

    先执行创建一个集合专门用来存储自增数字

    db.createCollection("counters")
    db.counters.insert({_id:"productid",sequence_value:1})

     

    批量插入数据的同时,递增索引

    const collection = db.get('admin'); //admin是集合,根据需求修改成自己的集合
    db.get('counters').find({}).then((docs) => {  //1,先查询当前最新的自增数值是多少
       var _id=docs[0].sequence_value;
       function autoadd() {
          return ++_id;   //2,当前最新的自增数,每次都累加1
       }
       collection.insert([
         {"_id":autoadd(),user: ctx.request.body.user,pass: ctx.request.body.pass},  //3,每插入一条数据,索引就累加1了
         {"_id":autoadd(),user:'a123',pass:'456'},
         {"_id":autoadd(),user:'b123',pass:'456'},
         {"_id":autoadd(),user:'c123',pass:'456'},
         {"_id":autoadd(),user:'d123',pass:'456'}]
       ).then((doc)=>{
         obj.aa=doc;
         //4,插入的数据结束后,更新下存储的自增数的集合,方便下次插入数据时,接着最新的索引。
         db.get('counters').findOneAndUpdate({sequence_value: (doc[0]["_id"])-1}, {sequence_value: doc[doc.length-1]["_id"]}).then(()=>{a();})
       });
    });

    —————————————————————

    //为了集合添加一条文档
    db.get('集合').insert([
     {
       "_id":autoadd(), //也可以执行函数
       post_title: filter.html2Escape(ctx.request.body.post_title),
       post_con: ctx.request.body.post_con,
       category:ctx.request.body.category,
       time:moment().format('YYYY-MM-DD kk:mm:ss')
     }
    ])
    
    //同时添加多个文档
    db.get('集合').insert([{ woot: 'bar' }, { woot: 'baz' }])

     

    db.get('集合').remove()  //删除某集合下里面的所有文档
    db.get('集合').remove({"_id":1});  //根据条件删除_id=1的文档

     

    db.get('集合').update({name: '123'}, {$set :{num:456}}) //找到集合下含name=123的一个条文档,修改它字段num值为456
    db.get('集合').update(
      { type : "book" },
      { $inc : { qty : 1 } },  //$inc是数字累加
      { multi: true }
    )    //找到集合里面所有type=book的文档,让各自的文档中qty的字段累加1

     

     

     

    db.get('集合').find({}).then((doc)=>{})  //获取到集合的所有文档
    db.get('集合').find({"_id":1}).then((doc)=>{})  //只获取指定id的文档
    
    //模糊搜索,搜索集合中的post_title字段或者post_con字段,若含有指定关键词,就选取出来相应的文档
    db.get('集合').find({$or:[{"post_title":new RegExp(ctx.query['search[value]'],'ig')},{"post_con": new RegExp(ctx.query['search[value]'],'ig')}]})
    
    //模糊搜索,搜索post集合,在集合的字段post_title或者post_con字段中如果含有value关键词,就选出所有符合条件的数据,
    并且以字段_id的为准降序排列(数字大到小),忽略前10条数据,从第11条数据开始,只显示5条数据,每条数据不显示post_con字段。
    db.get('post').find({$or:[{"post_title":new RegExp(ctx.query['search[value]'],'ig')},{"post_con": new RegExp(ctx.query['search[value]'],'ig')}]}, 
     {
       fields: { post_con: 0 },
       sort: {"_id": -1},
       limit: 5,
       skip: 10
    })
    
    
    db.get('集合').count()  //条数
    db.get('集合').count({name: 'foo'})  //返回字段name的值是foo的所有文档条数
    
    findOne()  //不管数据多少,只显示一条数据
    findOneAndDelete()  //不管数据多少,只找到一条数据并删除
    findOneAndUpdate()

     

     

     

    关闭与数据库连接

    db.close()

     

     

     

     

     

     

  • 谷歌插件wappalyzer

    网站插件检测

    查看分析网站当前运用了哪些脚本语言、数据库、服务器等等:
    wappalyzer

  • centos 6.x手动安装编译nginx

    centos安装nginx

    1,下载nginx
    http://nginx.org/download/nginx-1.11.12.tar.gz
    http://nginx.org/en/download.html

     

    2,安装Nginx所依赖的包:

    gcc -v   //查看系统是否安装gcc

    rpm -qa | grep pcre  或者 pcre-config –version  //是否安装pcre

    rpm -qa | grep zlib //是否安装zlib

    openssl version   或者  openssl version -a  //是否安装  (最低要求1.0.2)

    wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz
    tar zxf openssl-1.1.0e.tar.gz

    (一般情况下系统都会安装的)
    yum -y install pcre*

    yum -y install openssl*

    yum -y install zlib*

     

    3,切换到下载好的压缩包所在目录
    例如:tar -zxvf nginx-1.11.12.tar.gz

     

    4,查看openssl安装目录
    一般在目录:
    /usr/local/ssl
    /usr/local/openssl
    /usr/local/lib64 (我的在)

    如果你是用rpm安装的
    可以用命令
    rpm -ql openssl

     

    5,进入到解压好的nginx目录里面

    关闭防火墙:service iptables stop
    执行:

    ./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --with-openssl=/usr/lib64/openssl --with-http_stub_status_module --with-debug --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_v2_module

    别人的安装参数:

    --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2'
    --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now'
    --prefix=/usr/share/nginx
    --conf-path=/etc/nginx/nginx.conf
    --http-log-path=/var/log/nginx/access.log
    --error-log-path=/var/log/nginx/error.log
    --lock-path=/var/lock/nginx.lock
    --pid-path=/run/nginx.pid
    --http-client-body-temp-path=/var/lib/nginx/body
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi
    --http-proxy-temp-path=/var/lib/nginx/proxy
    --http-scgi-temp-path=/var/lib/nginx/scgi
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi
    --with-debug
    --with-pcre-jit
    --with-ipv6
    --with-http_ssl_module
    --with-http_stub_status_module
    --with-http_realip_module
    --with-http_auth_request_module
    --with-http_addition_module
    --with-http_dav_module
    --with-http_geoip_module
    --with-http_gunzip_module
    --with-http_gzip_static_module
    --with-http_image_filter_module
    --with-http_v2_module
    --with-http_sub_module
    --with-http_xslt_module
    --with-stream
    --with-stream_ssl_module
    --with-mail
    --with-mail_ssl_module
    --with-threads

     

    6,接着编译
    make && make install

     

    7,启动nginx

    cd /usr/local/nginx/sbin
    /usr/local/nginx/sbin/nginx -V //查看版本和查看已安装模块
    执行./nginx
    启动:./nginx
    停止:./nginx -s stop
    重启:./nginx -s reopen
    执行./nginx -h 可以看到命令的帮助信息

    配置文件:
    /nginx/nginx/conf/nginx.conf

     

    8,加入系统托管,利用chkconfig控制

    //执行文件名为:nginx

    (注意路径)

    #!/bin/bash
    # chkconfig: - 30 21
    # description: http service.
    # Source Function Library
    . /etc/init.d/functions
    
    # Nginx Settings
    NGINX_SBIN="/usr/local/nginx/sbin/nginx"
    NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
    NGINX_PID="/usr/local/nginx/logs/nginx.pid"
    
    RETVAL=0
    prog="Nginx"
    
    start() {
     echo -n $"Starting $prog: "
     mkdir -p /dev/shm/nginx_temp
     daemon $NGINX_SBIN -c $NGINX_CONF
     RETVAL=$?
     echo
     return $RETVAL
    }
    
    stop() {
     echo -n $"Stopping $prog: "
     killproc -p $NGINX_PID $NGINX_SBIN -TERM
     rm -rf /dev/shm/nginx_temp
     RETVAL=$?
     echo
     return $RETVAL
    }
    
    reload(){
     echo -n $"Reloading $prog: "
     killproc -p $NGINX_PID $NGINX_SBIN -HUP
     RETVAL=$?
     echo
     return $RETVAL
    }
    
    restart(){
     stop
     start
    }
    
    configtest(){
     $NGINX_SBIN -c $NGINX_CONF -t
     return 0
    }
    
    case "$1" in
     start)
     start
     ;;
     stop)
     stop
     ;;
     reload)
     reload
     ;;
     restart)
     restart
     ;;
     configtest)
     configtest
     ;;
     *)
     echo $"Usage: $0 {start|stop|reload|restart|configtest}"
     RETVAL=1
    esac
    
    exit $RETVAL

     

    执行以下步骤:

    cp nginx /etc/rc.d/init.d/

    chmod 755 /etc/init.d/nginx

    chkconfig –level 2345 nginx on

    chkconfig –list nginx  //2345都是on表示设置成功

    下载: nginx

     

    nginx.conf  //一些常用配置

     user root;
    #user nobody;
    worker_processes 1;
    
    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;
    
    #pid logs/nginx.pid;
    
    
    events {
     worker_connections 1024;
    }
    
    
    http {
     proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
     proxy_temp_path /var/tmp;
     include mime.types;
     default_type application/octet-stream;
     sendfile on;
     keepalive_timeout 65;
     
     gzip on;
     gzip_comp_level 6;
     gzip_vary on;
     gzip_min_length 1000;
     gzip_proxied any;
     gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
     gzip_buffers 16 8k;
     
      ssl_certificate /root/www/Nginx/1_www.easynode.cn_bundle.crt;
     ssl_certificate_key /root/www/Nginx/2_www.easynode.cn.key;
     ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK;
    ssl_prefer_server_ciphers on;
     
     upstream silly_face_society_upstream {
     server 127.0.0.1:3000;
     #server 127.0.0.1:8887;
     keepalive 64;
     }
     
    
    
    
    
    
    
     
     server {
     listen 80;
     listen 443 ssl;
     
     server_name www.easynode.cn;
     
     #error_page 502 /errors/502.html;
     
     if ($scheme = http) {
     return 301 https://$server_name$request_uri;
     }
    
     #location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {
     #root /root/www/easynode/public;
     #access_log off;
     #expires max;
     #}
     
     location ~ .*\.(woff|eot|svg|ttf|favicon.ico|gif|jpg|jpeg|png|bmp|swf)$
     {
     access_log off;
     log_not_found off;
     expires max;
     root /root/www/easynode/public; #重点
     }
    
     location ~ .*\.(js|css)?$
     {
     access_log off;
     log_not_found off;
     expires max;
     root /root/www/easynode/public; #重点
     }
    
    
    
    
    
     #location /errors {
     # internal;
     # alias /usr/local/silly_face_society/node/public/errors;
     #}
     
     location / {
     proxy_redirect off;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto $scheme;
     proxy_set_header Host $http_host;
     proxy_set_header X-NginX-Proxy true;
     proxy_set_header Connection "";
     proxy_http_version 1.1;
     proxy_cache one;
     proxy_cache_key sfs$request_uri$scheme;
     proxy_pass http://silly_face_society_upstream;
     }
    
     
     
     }
    
    
    
    
    
    }

     

    9,为nginx添加额外模块

    (1)./nginx -V  //获取到当前的参数

    例如:
    --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --with-openssl=/root/openssl-1.1.0e --with-http_stub_status_module

    (2)例如安装下载nginx-rtmp-module模块,去下载该模块解压获取到该模块的目录。

    /root/nginx-rtmp-module-master  //解压后的路径

    (3)在nginx根目录下看是否有configure文件,有可以进行安装,追加模块安装

    ./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --with-openssl=/root/openssl-1.1.0e --with-http_stub_status_module --add-module=/root/nginx-rtmp-module-master
    make //在接着执行,千万不要执行make install

    (4)到sbin目录下备份一下原来的nginx文件,例如改成nginx_bak

    (5)到objs目录下把nginx复制到sbin目录中即可,之后到sbin目录执行./nginx -V看看是否追加了安装的模块