下载
wget http://nginx.org/download/nginx-1.8.0.tar.gz
解压
tar -zxvf nginx-1.8.0.tar.gz
设置安装参数
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx
- –prefix=/usr/local/nginx 代表安装目录
编译源代码并安装
make && make install
设置环境变量
echo "export NGINX_HOME=/usr/local/nginx" >> /etc/profile
echo "PATH=\$PATH:\${NGINX_HOME}/sbin" >> /etc/profile
source /etc/profile
nginx -C ${NGINX_HOME}/conf/nginx.conf
查看NGINX版本
nginx -v