var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337);
console.log('Server running at http://127.0.0.1:1337/');
这样的话地址栏输入ip能访问,如何变成域名去访问呢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
http://www.nginx.cn/927.html Nginx反向代理
配置本地host,Host文件加入
127.0.0.1 yourhost.comhost
1. Windows
C:\Windows\System32\drivers\etc\hosts2. Linux
/etc/hosts当然 域名访问,请先把http里端口配成80
如果80端口占用了,建议用nginx做个反向代理
请用Nginx反向代理