zoukankan      html  css  js  c++  java
  • nginx 安装

    nginx 安装 (http://nginx.org)

    一、安装nginx时必须先安装相应的编译工具
    yum -y install gcc gcc-c++ autoconf automake
    yum -y install zlib zlib-devel openssl openssl-devel pcre-devel

    #yum install -y zlib-devel

    1、wget http://nginx.org/download/nginx-1.5.0.tar.gz
    2、tar zxvf nginx-1.5.0.tar.gz
    3、cd nginx-1.5.0
    4、    #./configure --without-http_rewrite_module  --prefix=/usr/local/web_server/nginx/
             ./configure --prefix=/usr/local/web_server/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-pcre
    5、make && make install

    6、启动、停止

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

    停止
    步骤1:查询nginx主进程号
    ps -ef | grep nginx
    在进程列表里 面找master进程,它的编号就是主进程号了。
    步骤2:发送信号
    从容停止Nginx:
    kill -QUIT 主进程号
    快速停止Nginx:
    kill -TERM 主进程号
    强制停止Nginx:
    pkill -9 nginx

    另外, 若在nginx.conf配置了pid文件存放路径则该文件存放的就是Nginx主进程号,如果没指定则放在nginx的logs目录下。有了pid文 件,我们就不用先查询Nginx的主进程号,而直接向Nginx发送信号了,命令如下:
    kill -信号类型 '/usr/nginx/logs/nginx.pid'

    注意,修改了配置文件后最好先检查一下修改过的配置文件是否正 确,以免重启后Nginx出现错误影响服务器稳定运行。判断Nginx配置是否正确命令如下:
    nginx -t -c /usr/nginx/conf/nginx.conf 或者 /usr/nginx/sbin/nginx -t



    /usr/sbin/groupadd -f www
    /usr/sbin/useradd -g www www


    错误提示:./configure: error: the HTTP rewrite module requires the PCRE library.
    解决办法:安装pcre-devel解决问题 yum -y install pcre-devel

    错误提示:./configure: error: the HTTP cache module requires md5 functions
    from OpenSSL library.   You can either disable the module by using
    --without-http-cache option, or install the OpenSSL library into the system,
    or build the OpenSSL library statically from the source with nginx by using
    --with-http_ssl_module --with-openssl=<path> options.
    解决办法:yum -y install openssl openssl-devel

  • 相关阅读:
    sqlhelper使用指南
    大三学长带我学习JAVA。作业1. 第1讲.Java.SE入门、JDK的下载与安装、第一个Java程序、Java程序的编译与执行 大三学长带我学习JAVA。作业1.
    pku1201 Intervals
    hdu 1364 king
    pku 3268 Silver Cow Party
    pku 3169 Layout
    hdu 2680 Choose the best route
    hdu 2983
    pku 1716 Integer Intervals
    pku 2387 Til the Cows Come Home
  • 原文地址:https://www.cnblogs.com/linyu/p/3911803.html
Copyright © 2011-2022 走看看