一、安装编译工具及库文件
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel如果是Ubuntu系统,请使用
sudo apt-get install openssl
sudo apt-get install libssl-dev
二、安装make(如果已有请略过)
# 将ubuntu-make加入apt软件仓库的列表sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
# 升级apt的软件仓库,为了加入刚才的ubuntu-make
sudo apt update
# 安装ubuntu-make
sudo apt install ubuntu-make
三、安装 GCC 和 G++ C++ 开发环境
1.先安装 :sudo apt-get install build-essential
2.查看 gcc 版本 然后安装 统一版本的 g++
gcc --versiongcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
3 安装 g++
sudo apt-get install g++-4.4
4查看安装版本
g++ --version
g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
四、安装PCRE
PCRE 作用是让 Nginx 支持 Rewrite 功能。
[root@bogon src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2、解压安装包:
[root@bogon src]# tar zxvf pcre-8.35.tar.gz
3、进入安装包目录
[root@bogon src]# cd pcre-8.35
4、编译安装
[root@bogon pcre-8.35]# ./configure [root@bogon pcre-8.35]# make && make install
5、查看pcre版本
[root@bogon pcre-8.35]# pcre-config --version
五、安装 Nginx
从Nginx官网下载Nginx, 也可以选择现在下载
[root@bogon src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
2、解压安装包
[root@bogon src]# tar zxvf nginx-1.6.2.tar.gz
3、进入安装包目录
[root@bogon src]# cd nginx-1.6.2
4、编译安装
[root@bogon nginx-1.6.2]# ./configure [root@bogon nginx-1.6.2]# make [root@bogon nginx-1.6.2]# make install
5、查看nginx版本
[root@bogon nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v