problem description
after the egg.js project is started on the server, the page cannot be accessed by the public network. The service startup was successful
[egg-scripts] Save log file to /root/logs
[egg-scripts] Wait Start: 1...
[egg-scripts] egg started on http://127.0.0.1:7001
the environmental background of the problems and what methods you have tried
background: transfer the local egg.js project to Tencent Cloud server for deployment.
try method:
1. Change the service ipv6 to ipv4:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 15983 root 21u IPv4 38856616 0t0 TCP VM_0_13_centos:afs3-callback (LISTEN)
2, pm2 start:
[PM2] Starting /root/egg-example/server.js in fork_mode (1 instance)
[PM2] Done.
App name id version mode pid status restart uptime cpu mem user watching
server 0 1.0.0 fork 17017 online 0 0s 0% 3.1 MB root disabled
Use `pm2 show <id|name>` to get more details about an app
3. Server port opening setting:
related codes
/ / Please paste the code text below (do not replace the code with pictures)
what result do you expect? What is the error message actually seen?
I created a new server.js
file in the root directory of the project:
"use strict";
const http = require("http");
const app = http.createServer((req, res) => {
res.end("123");
});
app.listen("9600", () => console.log("success"));
after running, it is found that the external network can be accessed, but in this way, the service will be invalid after the console is disconnected.
I don"t understand what the problem is right now. What"s the difference between the two.
ask the bosses to give me some advice. No, no, no. It was a rough day yesterday
- ip:94.191.30.199
- password Aa12345678