• 【Ubuntu 16】安装nginx


    近年来,nginx服务器程序由于负载均衡、反向代理、适于高并发的特性,获得越来越多互联网企业的青睐。在此为大家奉上nginx的安装过程,以供参考。

    一、安装nginx

    1.安装gccg++库

    sudo apt-get install build-essential
    sudo apt-get install libtool

    2.安装prce库

    sudo apt-get install libpcre3 libpcre3-dev

    3.安装zlib依赖库

    sudo apt-get install zlib1g-dev

    4.安装ssl依赖库

    sudo apt-get install openssl

    5.切换到普通用户dream361

    dream361@ubuntu:~$ pwd
    /home/dream361/

    6.解压nginx源码包

    dream361@ubuntu:~$ tar xvf Downloads/nginx-1.10.3.tar.gz 

    7.进入到nginx目录

    dream361@ubuntu:~$ ./configure --prefix=/usr/local/nginx

    8. #编译 make  # 安装 sudo make  install #

    9.启动nginx

    sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    二、nginx常用命令

    启动

    sudo /usr/local/nginx/sbin/nginx

    停止

    sudo /usr/local/nginx/sbin/nginx -s stop

    重新加载

    sudo /usr/local/nginx/sbin/nginx -s reload

    指定配置文件

    sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    查看版本

    dream361@ubuntu:~$ /usr/local/nginx/sbin/nginx -v
    nginx version: nginx/1.10.3

    检查配置文件是否正确

    dream361@ubuntu:~$ sudo /usr/local/nginx/sbin/nginx -t
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

    显示帮助信息

    dream361@ubuntu:~$ /usr/local/nginx/sbin/nginx -h
    nginx version: nginx/1.10.3
    Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
    
    Options:
      -?,-h         : this help
      -v            : show version and exit
      -V            : show version and configure options then exit
      -t            : test configuration and exit
      -T            : test configuration, dump it and exit
      -q            : suppress non-error messages during configuration testing
      -s signal     : send signal to a master process: stop, quit, reopen, reload
      -p prefix     : set prefix path (default: /usr/local/nginx/)
      -c filename   : set configuration file (default: conf/nginx.conf)
      -g directives : set global directives out of configuration file



















     









     
  • 相关阅读:
    CF Gym 101955G Best ACMer Solves the Hardest Problem 平面加点,删点,点加权(暴力)
    CF Gym 101955C Insertion Sort
    狩猎大赛(社团周赛)
    CF 1215 D Ticket Game (博弈)
    CF1215 C Swap Letters(思维题)
    CF 1215 B The Number of Products(思维题)
    HDU 6740 MUV LUV EXTRA(求循环节)
    BZOJ 1491 [NOI2007]社交网络(Floyd变形)
    BZOJ 3039 玉蟾宫
    【luogu4124】【bzoj4521】 [CQOI2016]手机号码 [数位dp]
  • 原文地址:https://www.cnblogs.com/zhengwenqiang/p/6804623.html
Copyright © 2020-2023  润新知