
nginx可以使用各平台的默认包来安装,本文是介绍使用源码编译安装,包括具体的编译参数信息。
正式开始前,编译环境gcc g++ 开发库之类的需要提前装好,这里默认你已经装好。
ububtu平台编译环境可以使用以下指令
1
2
|
apt-get install build-essential
apt-get install libtool
|
centos平台编译环境使用如下指令
安装make:
1 |
yum -y install gcc automake autoconf libtool make |
安装g++:
1 |
yum install gcc gcc-c++ |
下面正式开始 --------------------------------------------------------------------------- 一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩。 1.选定源码目录 可以是任何目录,本文选定的是/usr/local/src
2.安装PCRE库 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:
1
2
3
4
5
6
7
|
cd /usr/local/src
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
tar -zxvf pcre-8.37.tar.gz
cd pcre-8.34
./configure
make
make install
|
3.安装zlib库 http://zlib.net/zlib-1.2.8.tar.gz 下载最新的 zlib 源码包,使用下面命令下载编译和安装 zlib包:
1
2
3
4
5
6
7
8
|
cd /usr/local/src
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make
make install
|
4.安装ssl(某些vps默认没装ssl)
1
2
3
|
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
tar -zxvf openssl-1.0.1t.tar.gz
|
5.安装nginx
Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
cd /usr/local/src
wget http://nginx.org/download/nginx-1.4.2.tar.gz
tar -zxvf nginx-1.4.2.tar.gz
cd nginx-1.4.2
./configure --sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=/opt/app/openet/oetal1/chenhe/pcre-8.37 \
--with-zlib=/opt/app/openet/oetal1/chenhe/zlib
织梦二维码生成器
------分隔线----------------------------
|
|