zoukankan      html  css  js  c++  java
  • cent os 6.2 64位 安装ngnix的方法

    从网上整理出来的:cent os6.2 64位 安装ngnix的方法。

    环境准备工作:
     yum -y install gcc gcc-c++ autoconf automake make  
     yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel   

    下载 nginx
     wget http://nginx.org/download/nginx-1.0.2.tar.gz  


    解压
     tar –xzvf nginx-1.0.2.tar.gz  
     cd nginx-1.0.2  
     ./configure  

    configure 支持下面的选项:

    --prefix=<path> - Nginx安装路径。如果没有指定,默认为 /usr/local/nginx。

    --sbin-path=<path> - Nginx可执行文件安装路径。只能安装时指定,如果没有指定,默认为<prefix>/sbin/nginx。

    --conf-path=<path> - 在没有给定-c选项下默认的nginx.conf的路径。如果没有指定,默认为<prefix>/conf/nginx.conf。

    --pid-path=<path> - 在nginx.conf中没有指定pid指令的情况下,默认的nginx.pid的路径。如果没有指定,默认为 <prefix>/logs/nginx.pid。

    --lock-path=<path> - nginx.lock文件的路径。

    --error-log-path=<path> - 在nginx.conf中没有指定error_log指令的情况下,默认的错误日志的路径。如果没有指定,默认为 <prefix>/logs/error.log。

    --http-log-path=<path> - 在nginx.conf中没有指定access_log指令的情况下,默认的访问日志的路径。如果没有指定,默认为 <prefix>/logs/access.log。

    --user=<user> - 在nginx.conf中没有指定user指令的情况下,默认的nginx使用的用户。如果没有指定,默认为 nobody。

    --group=<group> - 在nginx.conf中没有指定user指令的情况下,默认的nginx使用的组。如果没有指定,默认为 nobody。

    --builddir=DIR - 指定编译的目录

    --with-rtsig_module - 启用 rtsig 模块


    最后安装
     make && make install  

    启服务:
    可以写成一个脚本:
    #!/bin/bash
    /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    exit 0

    检测进程是否已启:
    ps -ef | grep nginx
    检测端口是否占用
    netstat  -anp | grep 8080 查看指定的端口

    在浏览器中输入IP:PORT
    Welcome to nginx!

    有可能出现的问题: 防火墙是否关闭  iptables 和 selinux

    了解Nginx,可以看看张宴的《实战Nginx:取代Apache的高性能Web服务器》这本书,主要是教人怎么用Nginx.

    **************************************** 

    在red hat 6.2 64bit安装时会出现如下错误:

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

    解决方法是要下载Rewrite模块的正则表达式依赖库:pcre

    选择的是: pcre-8.02.tar.gz

    地址:http://sourceforge.net/projects/pcre/?source=dlp

    tar -zxvf  pcre-8.02.tar.gz

    cd pcre-8.02

    ./configure

    make

    make install 

    完成后再执行nginx 下的./configure

  • 相关阅读:
    HTML5结构
    HTML5新增的非主体元素header元素、footer元素、hgroup元素、adress元素
    CF GYM 100703G Game of numbers
    CF GYM 100703I Endeavor for perfection
    CF GYM 100703K Word order
    CF GYM 100703L Many questions
    CF GYM 100703M It's complicate
    HDU 5313 Bipartite Graph
    CF 560e Gerald and Giant Chess
    POJ 2479 Maximum sum
  • 原文地址:https://www.cnblogs.com/fangshenghui/p/3074580.html
Copyright © 2011-2022 走看看