Using the Nginx proxy, the proxy address cannot be accessed

configured a Nginx proxy server under windows, started a server service using node, and used a separate configuration file test.conf, but could not access it through the address test.com configured in test.conf?

related codes

test.conf:

server {
  listen      80;
  server_name www.test.com;

  location /
  {
    proxy_pass http://127.0.0.1:8888;
  }
}
The configuration of test.conf is introduced in

nginx.conf:

include     servers/*.conf;

server.js:

const http = require("http")
const fs = require("fs")
const zlib = require("zlib")

http.createServer(function (request, response) {
  console.log("request come", request.url)

  const html = fs.readFileSync("test.html")
  response.writeHead(200, {
    "Content-Type": "text/html",
    // "X-Content-Options": "nosniff"
    "Content-Encoding": "gzip"
  })
  response.end(zlib.gzipSync(html))
}).listen(8888)

console.log("server listening on 8888")

test.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <form action="/form" id="form" enctype="application/x-www-form-urlencoded">
    <input type="text" name="name">
    <input type="password" name="password">
    <input type="file" name="file">
    <input type="submit">
  </form>
  <script>
    var form = document.getElementById("form")
    form.addEventListener("submit", function (e) {
      e.preventDefault()
      var formData = new FormData(form)
      fetch("/form", {
        method: "POST",
        body: formData
      })
    })
  </script>
</body>
</html>

server service is started. Running result:

test.com127.0.0.1:8888

Apr.02,2022

the domain name defined by yourself is not configured for DNS resolution. Open the C:\ Windows\ System32\ drivers\ etc\ hosts file, and write

at the end.
-sharp IP127.0.0.1
192.168.31.66 www.test.com

have you solved the exact same problem as mine?

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-1beb66d-31a85.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-1beb66d-31a85.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?