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

    nginx-1.4.1 centos安装手册

    1、权限
    请以root权限登陆
    如果非root权限登陆,请运行sudo su - 命令切换到root权限

    2、准备好编译环境(如果安装了可以省略)
    yum -y install wget gcc gcc-c++ ncurses-devel cmake make perl openssl openssl-devel

    服务器支持ssl证书(一般服务器默认支持)
    yum -y install openssl
    yum -y install openssl-devel

    3、准备好centos所需要的用户组(如果创建了可以省略)
    3.1、新增用户组
    groupadd www

    3.2、新增用户
    useradd www -g www

    4、准备好源代码安装目录(如果创建了可以省略)
    mkdir -p /root/src
    cd /root/src

    5、下载、编译pcre库
    5.1、下载pcre源代码压缩包
    wget http://sourceforge.net/projects/pcre/files/pcre/8.32/pcre-8.32.tar.gz/download

    5.2、解压源代码
    tar -vxzf pcre-8.32.tar.gz

    5.3、进入源代码目录
    cd pcre-8.32

    5.4、通过configure生成Makefile
    ./configure

    5.5、编译pcre
    make

    5.5、安装pcre
    make install

    6、下载、编译nginx和配置nginx
    6.1、下载nginx源代码压缩包
    wget http://nginx.org/download/nginx-1.4.1.tar.gz

    6.2、解压源代码
    tar -vxzf nginx-1.4.1.tar.gz

    6.3、进入源代码目录
    cd nginx-1.4.1

    6.4、通过configure生成Makefile
    ./configure --prefix=/usr/local/nginx --with-pcre --with-http_ssl_module

    prefix是指安装目录,一般安装在/usr/local/nginx

    ==========================================
    mynote:如果出现错误:./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using --without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib library
    statically from the source with nginx by using --with-zlib= option.
    则执行yum install -y zlib-devel,后重新生成Makefile

    6.5、编译nginx
    make

    6.5、安装nginx
    make install

    6.6 检查
    /usr/local/nginx/sbin/nginx -t
    若出现:
    /usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
    修改软链接
    ln -s /usr/local/lib/libpcre.so.1 /lib64/

    修改 ulimit限制
    vim /etc/security/limits.conf
    最下面加入

    • soft nofile 65535
    • hard nofile 65535
      重新打开ssh连接即可

    kill -QUIT 2072

  • 相关阅读:
    synchronized原理
    实现二叉搜索树
    2.oracle内存结构和后台进程02
    1.Oracle的内存结构和后台进程01
    15.Oracle的用户、Schema、数据库、表空间、数据文件的相互关系
    14.oracle的归档日志
    8.事务是隔离还是不隔离?
    7.行锁功过:怎么减少行锁对性能的影响?
    50.Mysql不完全恢复之innodb_force_recovery参数
    49.Mysql命令之Mysqlcheck
  • 原文地址:https://www.cnblogs.com/zhirusi/p/10129046.html
Copyright © 2011-2022 走看看