zoukankan      html  css  js  c++  java
  • Nginx在linux下安装及简单命令

    安装环境:Centos7

    创建目录及切换至目录

    # mkdir /usr/local/nginx
    # cd /usr/local/nginx/

    下载nginx包,访问http://nginx.org下载或http://nginx.org/download或使用命令下载

    wget http://nginx.org/download/nginx-1.17.3.tar.gz

    解压nginx包及移至解压目录

    # tar -zxvf nginx-1.17.3.tar.gz
    # cd nginx-1.17.3/

    设置安装路径

    # ./configure --prefix=/usr/local/nginx

    若出现错误【checking for C compiler ... not found】需要执行如下命令

    # yum -y install gcc gcc-c++ autoconf automake make

    若出现下面的错误,需要安装openssl

    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.

    安装openssl命令

    # yum -y install openssl openssl-devel

    编译--make是用来编译的,它从Makefile中读取指令,然后编译。

    # make

    安装--make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。

    # make install

    至此,nginx已经安装成功,接下来可以执行nginx命令来操作nginx

    命令

    启动 -- # /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

    重启 -- # nginx -s reload

    重新打开日志文件 -- # nginx -s reopen

    测试nginx配置文件是否正确 -- # nginx -t -c /usr/local/nginx/conf/nginx.conf

    快速停止 -- # nginx -s stop

    完整有序的停止 -- # nginx -s quit

    也可以通过进程停止nginx

    查询nginx主进程号 -- # ps -ef | grep nginx

    有序停止 -- # kill -QUIT 主进程号

    快速停止 -- # kill -TERM 主进程号

    强制停止 -- # pkill -9 nginx

    平滑启动 -- # kill -HUP 主进程号

  • 相关阅读:
    n个数字相加
    爬取编程常用词汇,保存为Excel
    Python对 Excel 的常用操作
    Python对Redis增删改查
    Python对MySql增删改查
    Python对MongoDB增删改查
    MySql事务的简单使用
    Python-判断回文
    Pyhton 连接数据库
    PyCharm设置完自动上传,却不会自动上传任何内容
  • 原文地址:https://www.cnblogs.com/GoCircle/p/11367695.html
Copyright © 2011-2022 走看看