The project adopts the mode of separation between front and rear ends, in which the routing relationship is Nginx A, which exposes the host address to the outside world, and all requests for App go directly to NginxB through the server.
The routing relationship is as follows: mobile App→ request (for example: www.test.cn: 8072/xp-web /index.html) →Nginx A→Nginx B
The server configuration of Nginx A routing to Nginx B is as follows:
server {
listen 8090;
# listen 192.25.106.214:8090;
server_name 192.25.106.214;
location /xy-app-web {
proxy_pass http://192.25.106.214:8090/xy-app-web;
proxy_set_header Host $host:8090;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Via "nginx";
}
location/{
root html;
index index.html index.htm;
}
}
Suddenly I found that there was A problem with the project, and the access interface reported an error. After checking the logs of Nginx A, I found the following errors:
[Error] 20969#0: *1 Connect () failed (111: Connection union) while connecting to upstream, Client: 192.25.103.53, Server: 192.25.106.214, Request: “GET /xy-app-web/portfolio/piazza?rettype=appjson& E72 opstation = Y_IHADPLAZA_12222222222_e9dfdb288326f0371d091ea8bd64b2f55b7906ff77b68db98ae99bafe0cf9896_07AE3442-1-4346 – A58B – 6 ee511202f01_30901_3. 9.0.11 & amp; logintoken=b6459d2e-1e85-489a-94e9-57d2059cba69& userId=5d395883d13573b189da524ce1401834& timestamp=1548750589604& client=3& device=appweb& version=appweb& clientId=appweb& Sign = 8 e6cfc226dbcf7dbd01a68a987363427 HTTP/1.0 “, upstream: “http://192.25.106.214:8090/xy-app-web/portfolio/piazza?rettype=appjson& E72 opstation = Y_IHADPLAZA_12222222222_e9dfdb288326f0371d091ea8bd64b2f55b7906ff77b68db98ae99bafe0cf9896_07AE3442-1-4346 – A58B – 6 ee511202f01_30901_3. 9.0.11 & amp; logintoken=b6459d2e-1e85-489a-94e9-57d2059cba69& userId=5d395883d13573b189da524ce1401834& timestamp=1548750589604& client=3& device=appweb& version=appweb& clientId=appweb& sign=8E6CFC226DBCF7DBD01A68A987363427”, host: “www.xyzqts.cn:8072”, referrer: “http://www.test.cn:8072/app-web/index.html”
Internet search for half a day is what shit like plagiarized article, what PHP problems. Our project did not have PHP, and the reason why connect() failed (111:Connection refused) while connecting to upstream was that the establishment of network Connection failed, so we started to check the call link from the place where the error was reported. Here we found that port 8090 did not provide service from the network call link of Telent Nginx B, A server of Nginx A. The simple way to do this is telent.
The correct picture for Telnet should look like this:
The problem is obvious. Take a look at which service is providing port 8090, indicate that the service is abnormal, and see if the process is still there.
ps -ef|grep java
I found that at some point, xy-app-Web on port 8090 was gone.
We’re using SpringBoot here, so start it.
nohup java -jar -Dlogging.path=./logs xy-app-web-0.0.2.jar --spring.profiles.active=test &
Check the process again: ps-ef |grep Java finds xy-app-web for port 8090 already available. Call the phone App again and find the problem solved.
Read More:
- error: \*1035 connect() failed (111: Connection refused) while connecting to upstream, client…..
- 【wget failed】Connecting to 127.0.0.1:7890… failed: Connection refused.
- How to Fix java.net.ConnectException: Connection refused: connect
- curl: (7) Failed connect to localhost:9200; Connection refused
- 【MongoDB】 Failed to connect to 127.0.0.1:27017, reason: Connection refused
- curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
- solve java.net.ConnectException : Connection refused:connect report errors
- samba Error NT_STATUS_CONNECTION_REFUSED Failed to connect with SMB1 — no workgroup available
- Nginx startup error: nginx: [error] open() “/ var / run / nginx/ nginx.pid The solution of “failed (2: no such file or directory)”
- failed to connect to ‘192.168.199.143:5555‘: Connection refused
- 【Synergy】Error:failed to connect to server:Connection was refused
- Running Django manager.py report errors Error:111 connecting to 127.0.0.1:6379.connection refused
- Failed to connect to 17.0.0.1 port 1080: Connection refused
- Solve the MAC terminal download error curl: (7) failed to connect to raw.githubusercontent.com port 443: Connection refused
- error:Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused;error:couldn‘t ….
- Java connection SQL error, network error IO Exception:Connection refused :connect
- JDBC connect to Sql Server to connect to the database–The TCP/IP connection to the host localhost, port 1433 has failed
- [Linux] curl: (7) failed to connect to 127.0.0.1 port 1086: connection reused solution
- Connection error:Cannot connect to redis-server. Details are available in connection log.
- Nginx: recv() failed (104: connection reset by peer) troubleshooting