1、下载nginx安装包
wget http://nginx.org/download/nginx-1.8.0.tar.gz
2、安装nginx所需依赖
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel
3、进入到nginx安装包目录下,解压tar.gz包
cd /home/soft
tar -zxvf nginx-1.8.0.tar.gz
4、创建nginx安装目录
mkdir /usr/local/nginx
5、进入到nginx源码目录,配置指定的安装路径
cd nginx-1.8.0/
./configure --prefix=/usr/local/nginx
6、进行编译安装
make
make install
7、查看/usr/local下的nginx是否安装,并修改nginx.conf配置
cd /usr/local/nginx/conf
vim nginx.conf
8、启动nginx并将80端口在防火墙中开放
/usr/local/nginx/sbin/nginx