centos下nginx安装

centos下nginx安装

  • 下载nginx
1
wget http://nginx.org/download/nginx-1.16.0.tar.gz
  • 解压并安装:
1
2
3
4
tar -zxvf nginx-1.16.0
cd nginx-1.16.0
./configure --prefix=/usr/local/nginx
make -j4 & make install

负载均衡配置

1
2
3
4
5
6
http{
upstream aaa.com{
server xxx.xxx.xxx.xxx;
least_conn;
}
}

反向代理

1
2
3
4
5
6
7
8
9
10
http{
server {
listen 80;
location /{
proxy_pass http://splash;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
}
}
文章作者: TangLyan
文章链接: https://toheart.github.io/2019/06/20/nginx/nginx-1/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 荦彦的博客
打赏一下