sudo apt-get install pcre* -y
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install zlib1g-dev
sudo apt-get install openssl libssl-dev
cd /opt/
wget http://nginx.org/download/nginx-1.18.0.tar.gz
cp nginx-1.18.0.tar.gz /usr/local
mv nginx-1.18.0 nginx
cd nginx/
./configure --prefix=/usr/local/nginx
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
mkdr -p /usr/local/nginx/logs/
nginx
ps -ef | grep nginx
mv nginx.conf nginx.conf.bak
vi nginx.conf
events {
worker_connections 1024; ## Default: 1024
}
http {
upstream upstream_name{
server 172.31.3.206:8083;
server 172.31.4.38:8083;
}
server {
listen 9083;
server_name localhost;
location / {
proxy_pass http://upstream_name;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
nginx -s reload
nginx -t