The relationship between nginx and host

suppose the local host file:

www.test.com 127.0.0.1

Local nginx.config file:

upstream www.test.com {
    server 192.168.10.78:9003 weight=1;
}
upstream static.test.com {
    server 127.0.0.1:8585 weight=1;
}
server {
    listen       80;
    server_name  www.test.com;

    location / {
        proxy_pass http://www.test.com;
    }
    location =/ {
        proxy_pass http://static.test.com;
    }
}

what happens if I type www.test.com enter in my browser now?
1. Nginx is represented to http://192.168.10.78:9003;
2. Go host and be represented to 127.0.0.1
3. First, nginx is represented to http://www.test.com and then ho.
what happens if I type enter enter in the browser now?
I didn"t understand ngin very well, but now it"s even more messy with host; can anyone explain it? Or is my file wrong?

Mar.02,2022

assume that nginx is built locally and uses HTTP1.1 . Enter www.test.com in the browser:

  1. check the local hosts file, find that the domain name is resolved, and get the resolved ip: 127.0.0.1 .
  2. Connect 127.0.0.1 port, and send http message. The first behavior of the message is GET / HTTP/1.1 , and the subsequent data includes Host: www.test.com and other
  3. .
  4. nginx gets the message and finds that the request uri is / , and host is www.test.com . Match to server_name www.test.com this server . Since the exact matching priority of location = / is higher than location / , the request to http://static.test.com is also http://127.0.0.1:8585/.

enter www.test.com/abcd/fff , nginx to match location / , so go http://www.test.com, that is, 192.168.10.78 code

  • Problems in building a local test environment for nginx

    I wanted to test the front-end project locally, so I built a development environment through the nginx server, but encountered a problem when I changed the nginx.conf configuration to server. The server configuration of nginx is: listen:8020;server_nam...

    Mar.20,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33aa7-2b3fc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33aa7-2b3fc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?