upstream a {
server 192.168.71.210:30080;
server 192.168.71.213:30080;
server 192.168.71.214:30080;
ip_hash;
}
upstream b {
server 192.168.71.210:30081;
server 192.168.71.213:30081;
server 192.168.71.214:30081;
ip_hash;
}
upstream c {
server 192.168.71.210:30082;
server 192.168.71.213:30082;
server 192.168.71.214:30082;
ip_hash;
}
< H2 > 2 demand < / H2 >
2.1 three services are loaded via K8S external nginx
2.2 access mode 192.168.100.100max a 192.168.100.100max b 192.168.100.100max c
3.1 load setting server above I will not write
3.2 nginx virtual machine configuration
server {
listen 80;
server_name localhost;
-sharpindex index.html index.htm index.php;
server_name_in_redirect off;
proxy_set_header Host $host:$server_port;
-sharpserver_name_in_redirect off;
-sharpproxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location /a/ {
proxy_pass http://127.0.0.1:81/;
}
location /b/ {
proxy_pass http://127.0.0.1:82/;
}
location /c/ {
proxy_pass http://127.0.0.1:83/;
}
}
server {
listen 81;
server_name www.localhost;
-sharpindex index.html index.htm index.php;
proxy_set_header Host $host:$server_port;
-sharpproxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://a;
-sharproot html/erp/;
}
location ~* \.(js|ico|css|find)?$ {
proxy_pass http://a;
}
}
server {
listen 82;
server_name www.localhost;
-sharpindex index.html index.htm index.php;
proxy_set_header Host $host:$server_port;
-sharpproxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://b;
}
}
server {
listen 83;
server_name localhost;
index index.html index.htm index.php;
proxy_set_header Host $host:$server_port;
-sharpproxy_set_header X-Real-IP $remote_addr;
-sharpproxy_set_header Cookie $http_cookie;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://c;
}
}
< H2 > 4 current situation description < / H2 >4.1 visit 192.168.100.100 br 81 192.168.100.100 82 192.168.100.100 83 (that is, there is no problem with the load agent)
4.2 you can also forward it again on port 80
.192.168.100.100/a 192.168.100.100:81
< H2 > 5 questions: < / H2 >
5.1 access to 192.168.100.100amp an is directly transferred to 192.168.100.100:81/index.php
. Can the 81 field be blocked? It looks normal. It should be like this. 192.168.100.100/a.index.php
5.2.When accessing 192.168.100.100 URI, the URI with port 81 is changed.
when I first logged in to the app, I clicked on the browser to record the password. The second login input directly 192.168.100.100pacer a showed that a lot of CSS JS and so on could not be loaded, and only with 192.168.100.100URI 81 on the test can it be accessed normally
the test shows that after the browser logs in to record the password, after entering the application, it is necessary to perform one step after the exit of the application, and the next login is normal! Personally, it is suspected that it is the problem of cookie
< H2 > 6 ask the god to take a look at it < / H2 >