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_name:m.hostname.com;location / {

root: /usr/local/var/www/itemname;
index: index.html

}
the problem is that I wrote in the system hosts file: 192.168.0.111ip 8020 (the ip address of my computer) m.hostname.com (also this domain name online)
but accessing m.hostname.com through the browser will not access my local front-end projects, but access online projects, but through 192.168.0.111 ip 8020 can access my local front-end projects, this is why?

Mar.20,2021

do not add port number to hosts

192.168.0.111   m.hostname.com
< hr >

I just made a mistake. In fact, you should write the local ip, instead of the intranet ip

.
127.0.0.1   m.hostname.com
  • 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_...

    Mar.02,2022
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-1e477f3-4cfd8.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-1e477f3-4cfd8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?