zoukankan      html  css  js  c++  java
  • Nginx 笔记与总结(1)编译安装

    Nginx 可以承受 3 万并发连接数,Apache 默认最大连接数是 256 个。

    编译安装

    ① 下载

    在 Nginx 的主页 http://nginx.org/ 下载最新的 stable version(稳定版)Nginx 1.8.0(http://nginx.org/en/download.html-http://nginx.org/download/nginx-1.8.0.tar.gz),ftp 传输到 /usr/local/src 目录下(CentOS 6.6)

    ② 解压

    tar zxvf nginx-1.8.0.tar.gz 

    ③ 进入目录

    cd nginx-1.8.0

    ④ 配置

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

    如果报错:

    ./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.

    解决方案:

    PCRE library 是正则表达式库,安装 pcre 包(二进制包):

    mount /dev/cdrom /mnt/cdrom #挂载光盘
    yum install pcre

    如果还是报同样的错,可以安装相应的 develop(头文件):

    yum install pcre-devel 

    重新配置:

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

    没有报错。

    ⑤ 编译、安装

    make && make install

    完毕。

    此时在 /usr/local 下能看到 nginx 目录:

    进入nginx 目录:

    cd nginx
    ll

    conf:配置文件目录

    html:网页文件目录

    logs:日志文件目录

    sbin:主要二进制程序

    sbin/nginx:主程序

    启动 Nginx:

    [root@localhost sbin]# cd ../
    [root@localhost nginx]# ./sbin/nginx 

    查看 80 端口的使用情况:

    netstat -antp

    或者

    netstat -tunpl | grep 80

  • 相关阅读:
    1044 拦截导弹
    3060 抓住那头奶牛 USACO
    2727:仙岛求药(广搜)
    4906 删数问题(另一种贪心思路)
    1004 四子连棋
    1005 生日礼物
    1031 质数环
    1008 选数
    1073 家族
    2801 LOL-盖伦的蹲草计划
  • 原文地址:https://www.cnblogs.com/dee0912/p/4662980.html
Copyright © 2011-2022 走看看