我在阿里云上面用node.js + nginx搭建一個個人網站,但是每次訪問都是‘welcom to nginx’提示server.js文件http.createServer(function(req, res){ const pathname = url.parse(req.url).pathname; console.log(pathname); switch(pathname){ case '': case '/':
index(req, res);break; default:
loadfiels(req, res, pathname);break;
}
}).listen(9000, '0.0.0.0');用pm2運行這個文件,啟動成功了:nginx 的配置conf/servers的文件下面有一個web.conf文件server { listen 80; server_name tonghuiflang.com; location / { proxy_pass http://127.0.0.1:9000;
}
}在conf/nginx.conf 和 conf/nginx.conf.default 的http最后 添加 include servers/*;可是通過域名訪問還是‘welcom to nginx’提示,在本地是沒有問題的
阿里云上面用node.js + nginx搭建網站,每次訪問都是‘welcom to nginx’
白豬掌柜的
2018-07-10 16:28:26