1. sudo apt-get install pcre* -y
    2. sudo apt-get update
    3. sudo apt-get install libpcre3 libpcre3-dev
    4. sudo apt-get install zlib1g-dev
    5. sudo apt-get install openssl libssl-dev
    6. cd /opt/
    7. wget http://nginx.org/download/nginx-1.18.0.tar.gz
    8. cp nginx-1.18.0.tar.gz /usr/local
    9. mv nginx-1.18.0 nginx
    10. cd nginx/
    11. ./configure --prefix=/usr/local/nginx
    12. make && make install
    13. ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
    14. mkdr -p /usr/local/nginx/logs/
    15. nginx
    16. ps -ef | grep nginx
    17. mv nginx.conf nginx.conf.bak
    18. vi nginx.conf
    19. events {
    20. worker_connections 1024; ## Default: 1024
    21. }
    22. http {
    23. upstream upstream_name{
    24. server 172.31.3.206:8083;
    25. server 172.31.4.38:8083;
    26. }
    27. server {
    28. listen 9083;
    29. server_name localhost;
    30. location / {
    31. proxy_pass http://upstream_name;
    32. proxy_set_header Host $host;
    33. proxy_set_header X-Real-IP $remote_addr;
    34. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    35. }
    36. }
    37. }
    38. nginx -s reload
    39. nginx -t