CentOS安装Nginx

一、安装基础环境包

yum -y install gcc gcc-c++ openssl*

二、安装PCRE

1、下载

    wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz

2、解压

  tar zxvf pcre-8.35.tar.gz

3、安装

  cd pcre-8.35

  ./configure

  make && make install

三、安装Nginx

1、下载Nginx

  wget http://nginx.org/download/nginx-1.7.3.tar.gz

2、解压

  tar zxvf nginx-1.7.3.tar.gz

3、安装

  cd nginx-1.7.3

  ./configure --prefix=/opt/nginx --with-http_ssl_module  --with-http_stub_status_module 

  make && make install

  注:--prefix=/opt/nginx,nging安装目录;--with-http_ssl_module,开启HTTP SSL模块,使NGINX可以支持HTTPS请求。这个模块需要已经安装了OpenSSL;--with-http_stub_status_module,开启 nginx 的 NginxStatus功能,用来监控 Nginx 的当前状态。

四、启动Nginx

1、启动

  /opt/nginx/sbin/nginx

  报错:nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

  解决办法:

  64bit:ln -s /usr/local/lib/libpcre.so.1 /lib64

  32bit:ln -s /usr/local/lib/libpcre.so.1 /lib

2、查看是否已启动Nginx

  lsof -i:80

posted @ 2014-07-30 23:09  lbw  阅读(247)  评论(0编辑  收藏  举报