• Linux


    1.复制解压。

    [root@localhost ~]# mv /opt/nginx-1.13.8.tar.gz /usr/local/src
    [root@localhost ~]# cd /usr/local/src
    [root@localhost src]# tar -zxvf nginx-1.13.8.tar.gz 
    

    2.编译安装

    [root@localhost src]# cd nginx-1.13.8
    [root@localhost nginx-1.13.8]# ./configure --prefix=/usr/local/nginx 
    

    如果没有安装pcre、pcre-devel、openssl、zlib都安装一下。

    提示

    Configuration summary
      + using system PCRE library
      + OpenSSL library is not used
      + using system zlib library
    
    [root@localhost nginx-1.13.8]# ./configure --prefix=/usr/local/nginx  --with-openssl=/usr/local/openssl
    

    调整,增加openssl位置绑定。

    3.安装

    make && make install
    

    4.检测是否安装成功

    ps -ef |grep nginx
    

    ps 查看进程。
    -e 显示所有进程。
    -f 全格式。

    [root@localhost sbin]# ./nginx
    [root@localhost sbin]# ps -ef |grep nginx
    root       9334      1  0 18:38 ?        00:00:00 nginx: master process ./nginx
    nobody     9335   9334  0 18:38 ?        00:00:00 nginx: worker process
    root       9341   4092  0 18:38 pts/1    00:00:00 grep nginx
    

    5.配置环境变量

    [root@localhost sbin]# vim /etc/profile
    
    PATH=$PATH:/usr/local/nginx/sbin
    export PATH
    
    [root@localhost sbin]# source /etc/profile
    

    这个时候就可以在任何地方操作nginx了。

    [root@localhost local]# nginx -s stop
    [root@localhost local]# ps -ef |grep nginx
    root       9370   4092  0 18:46 pts/1    00:00:00 grep nginx
    

    6.nginx关闭

    [root@localhost local]# nginx -s stop
    

    其他的方式

    kill -quit 主进程号
    kill -term 主进程号
    pkill -9 nginx
    

    7.配置service脚本

    [root@localhost nginx]# vim nginx
    
    #! /bin/bash
    # chkconfig: - 85 15
    # description: nginx is a World Wide Web server. It is used to serve
    case "$1" in
        start)
            /usr/local/nginx/sbin/nginx
            ;;  
        stop)
            /usr/bin/killall -s QUIT nginx
            ;;  
        restart)
            $0 stop
            $0 start
            ;;  
        reload)
            /usr/bin/killall -s HUP nginx
            ;;  
        *)  
            echo "Usage:$0 {start|stop|restart|reload}"
            exit 1
    esac
    exit 0
    
    
    
    [root@localhost nginx]# cp /usr/local/nginx/nginx /etc/init.d
    [root@localhost nginx]# chmod a+x /etc/init.d/nginx 
    [root@localhost nginx]# chkconfig --add nginx
    [root@localhost nginx]# chkconfig --level 2345 nginx on
    [root@localhost nginx]# service nginx stop
    [root@localhost nginx]# ps -ef |grep nginx
    root       9532   4092  0 19:23 pts/1    00:00:00 grep nginx
    
    
  • 相关阅读:
    Toast的替代者Snackbar
    SnappyDB—Android上的NoSQL数据库简介
    ButterKnife使用小结
    The following classes could not be found:
    asp.net后台解析JSON,并将值赋给对象
    .NET4.0的listview与DataPager的结合使用时的模板编辑
    ASP.NET 后台页面无法识别服务器控件ID
    Asp.net中判断是否是指定页面请求的代码示例
    ASP.NET中修改从数据库获取的datatable中的值
    GridView自定义分页样式(上一页,下一页,到第几页)
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/8257427.html
Copyright © 2020-2023  润新知