problem description:
I use node.js + nginx to build a personal website on Aliyun, but every visit is a "welcom to nginx" prompt
- server.js file
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");
run this file with pm2 and start successfully:
- configuration of nginx
conf/servers
server {
listen 80;
server_name tonghuiflang.com;
location / {
proxy_pass http://127.0.0.1:9000;
}
}
add include servers/*; at the end of the http of conf/nginx.conf and conf/nginx.conf.default
but access through the domain name or "welcom to nginx" prompt, there is no problem locally