(1)下载
wget http://nginx.org/download/nginx-1.12.2.tar.gz
(2) 安装依赖
yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel
(3) 解压
tar -zxvf nginx-1.12.2.tar.gz
cd nginx-1.12.2/
(4) 执行配置
./configure
(5) 编译安装
make
make install
(6) 设置反向代理
location /api{# rewrite ^/app\/(.*)$ /$1 break;
proxy_pass http://localhost:10070;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 10;
proxy_send_timeout 10;
proxy_read_timeout 10;
}
location / {
root /DATA/work/build;
index index.html;
}