The deployment port of Nuxt on Ali CVM cannot be accessed all the time.

< H2 > problem: according to the official deployment method, the output deployment is successful, but it cannot be accessed all the time < / H2 >

initialize the simplest DEMO, directly on the server and then access it in ip:3000, but you can"t access it either

try to use express to create a simple server that can also be accessed
const express = require("express");
const app = express();
app.get("/",(req,res) => {
  res.send("hello wored")
});

const server = app.listen(3000, () => {
  console.log(server.address().port)
})

you can request successfully with the port of express, but the service started with Nuxt cannot be accessed no matter what port it is, and there is no problem locally on the server.

the server is Ali Cloud"s CVM ECS

search and query on the Internet, nuxt build nuxt start can be successful directly, there is no problem locally, but on the server, no matter what port is used, access is not successful, and it is possible to use express.

the project has been filled out one by one step by step, and has been deployed for a long time. Ask God for advice
Mar.04,2021

problem has been solved: the solution is the global package problem of nuxt, which can be accessed by uninstalling and reinstalling. The network of the server will actually lose packets, and there is an impulse to smash the wall.
and HOST needs to be set to: 0.0.0.0 PORT = port number

Menu