我的共享主机不允许我定制。但是,我无论如何安装了nodejs。我还在/var/www/test-server目录中编写了一个快速服务器代码。
const express = require('express')
const app = express()
const port = 8080
app.get('/', (req, res) => {
res.send('Hello World!')
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})·但是,我无法访问快递服务器
·我不能使用端口80。
·当我使用诸如8080之类的其他端口时,我可以看到终端上的控制台输出如下:
example.work@example:/var/www/test-server$ node index.js
Example app listening on port 8080我的问题是-
“可以通过浏览器访问带有或不带端口的快速服务器吗?”
喜欢:http://example.com/test-server
发布于 2022-12-03 16:36:42
必须设置NGINX才能使快捷服务器在域上可用。或者,您可以访问http://ipofthemachine:port上的服务器,确保您正在使用的端口是公开的,如果您有任何防火墙。
https://stackoverflow.com/questions/74668272
复制相似问题