(centos7) linux build nginx load balancing build
http://creativecommons.org/licenses/by-sa/4.0/ Copyright statement: This article is the original article of the blogger, and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.
Link to this article: [https://blog.csdn.net/qq_37933685/article/details/82192354](https://blog.csdn.net/qq_37933685/article/details/82192354)
- Virtual machine preparation, I am a linux development machine + 4 centos virtual machines
- Virtual machine preparation environment: ngnix server needs to open port 80 (ngnix default port) to ensure that all machines can be pinged (that is, network communication between servers), business server environment: jre1.8, open business ports (Mine is port 8888)
- (The installation process of nginx is below) Configure nginx reverse proxy
The content of the ngnix.conf modified file should be configured as follows, which can be customized
# Source of response data
upstream tomcats {
server 192.168.0.202:8888 weight=1;
server 192.168.0.203:8888 weight=1;
server 192.168.0.204:8888 weight=1;}
server {
listen 80;
server_name veng_bike;
location ~.*{
proxy_pass http://tomcats;}}
Install nginx process##
- Upload the nginx installation package
- Unzip nginx
tar -zxvf nginx-1.12.2.tar.gz -C /usr/local/src/
- Enter the source directory of nginx
cd /usr/local/src/nginx-1.12.2/
- Precompiled
. /configure
- Quiet gcc compiler
yum -y install gcc pcre-devel openssl openssl-devel
- Then execute
. /configure
- Compile and install nginx
make && make install
- Start nginx
sbin/nginx
- View nginx process
ps -ef | grep nginx
netstat -anpt | grep nginx