我已经在Google云服务器上安装了 node.js 。但是运行命令 sudo node test.js 时出现错误。 Web根目录为/ var / www / ******* /,虚拟主机文件为/ etc / apache2 / *****。conf
我正在尝试通过端口3004访问它。我也在防火墙中启用了它。
虚拟主机配置:
<VirtualHost *:80>
ServerName domainname.com
ServerAdmin test@gmail.com
DocumentRoot "/var/www/******/"
<Directory "/var/www/******/">
Options -Indexes
AllowOverride All
Require all granted
</Directory>
</Virtualhost>
<VirtualHost *:3004>
ServerName domainname.com
ServerAdmin test@gmail.com
DocumentRoot "/var/www/******/"
<Directory "/var/www/******/">
Options -Indexes
AllowOverride All
Require all granted
</Directory>
</Virtualhost>
================================================ ================
错误:
Server running at http://domainname.com:3004/
events.js:173
throw er; // Unhandled 'error' event
^
Error: listen EADDRNOTAVAIL: address not available **.***.***.**:3004
at Server.setupListenHandle [as _listen2] (net.js:1239:19)
at listenInCluster (net.js:1304:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1443:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:63:10)
Emitted 'error' event at:
at emitErrorNT (net.js:1283:8)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
请帮助。
谢谢, 毗湿奴。