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

  • 相关阅读:
    javascript通用函数库
    Nginx的负载均衡的那点事
    四种多服务器共享session的方法
    Nginx 配置文件nginx.conf的完整配置说明<转>
    Struts2标签问题-using Struts tags without the associat
    转:ibatis的cacheModel
    大型互联网网站架构心得之一
    nginx的upstream(解决session问题)
    rails3项目解析之1——系统架构
    使用 Nginx 提升网站访问速度
  • 原文地址:https://www.cnblogs.com/linyu/p/3911803.html
Copyright © 2011-2022 走看看