1. Nginx Installation steps
1.1 website
http://nginx.org/en/download.html
1.2 Upload installation package
Upload to the specified directory /usr/local/src
1.3 decompression Nginx Compressed files
1. Move the installation directory to the specified file
mv nginx-1.19.4.tar.gz software/
2. Modify file name
mv nginx-1.19.4 nginx
1.4 About nginx Directory description
1.5 install nginx The server
explain : Execute the following command in the source file
-
./configure
The immediate result :
-
make
-
make install
1.6 nginx Command specification
explain : nginx Working directory description
route :
command :
1.windows command :
1. Start command : start nginx
2. Restart command : nginx -s reload
3. The shutdown command : nginx -s stop
2.Linux command :
1. Start command : ./nginx
2. Restart command : ./nginx -s reload
3. The shutdown command : ./nginx -s stop
1.7 modify nginx The configuration file
Requirement specification :
1. Realize image reverse proxy
2. Realization tomcat Load balancing implementation
Concrete realization :
After the modification is completed , restart nginx The server .
# Configure image proxy server http://image.jt.com:80
server {
listen 80;
server_name image.jt.com;
location / {
#root D:/JT-SOFT/images;
root /usr/local/src/images;
}
}
# Configure the product background server
server{
listen 80;
server_name manage.jt.com;
location / {
# Proxy real server address
#proxy_pass http://localhost:8091;
# Mapping to clusters
#proxy_pass http://jtWindows;
proxy_pass http://jtLinux;
}
}
# To configure tomcat Server cluster 1. Default Polling strategy 2. Weight strategy 3.ip_hash Strategy
upstream jtWindows {
#ip_hash; down Identify downtime backup Spare machine
#max_fails=1 The maximum number of failures
#fail_timeout=60s If there's no access , It's in 60 Seconds , No more access to the malfunctioning machine
server 127.0.0.1:8081 max_fails=1 fail_timeout=60s;
server 127.0.0.1:8082 max_fails=1 fail_timeout=60s;
server 127.0.0.1:8083 max_fails=1 fail_timeout=60s;
}
upstream jtLinux {
server 192.168.126.129:8081;
server 192.168.126.129:8082;
server 192.168.126.129:8083;
}
1.8. modify hosts file
explain : Because I didn't buy image/manage.jt.com Domain name of , So you have to go through hosts File modification turns to .
modify windows Medium hosts file :
# Jingtao configuration
192.168.126.129 image.jt.com
192.168.126.129 manage.jt.com
#IP domain name The mapping relationship
#127.0.0.1 image.jt.com
#127.0.0.1 manage.jt.com
127.0.0.1 www.jt.com
127.0.0.1 sso.jt.com
127.0.0.1 localhost
#bug The problem of losing the last letter