Node.js无法在服务器运行求助:附Node.js代码及Nginx配置
Node.js 服务器代码与Nginx配置整理
我把你尝试在服务器启动Node.js的代码,以及对应的Nginx配置片段整理并格式化好了,方便你查看和调试:
Node.js 服务器代码
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(8080, 'xx.xx.xx.xx'); console.log('Server running at http://xx.xx.xx.xx:8080/');
Nginx 配置文件(/etc/nginx/nginx.conf)片段
# For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/r...
内容的提问来源于stack exchange,提问作者LIGHT
相关产品推荐
相关产品推荐

