Error: listen EADDRNOTAVAIL: address not available **.***.***.**:3004 - node.js

I have installed node.js on a google cloud server. But I'm getting an error while running the command sudo node test.js. The web root is /var/www/*******/ and the virtual host file is /etc/apache2/*****.conf
I'm trying to access it through the port 3004. I have enabled it in the firewall as well.
Virtual host configuration:
<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>
===============================================================
Error:
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)
Please help.
Thanks,
Vishnu.

Related

Debian 9 Apache : Missing address for VirtualHost

i keep getting this error after running the command
# sudo apache2ctl configtest
[Wed Mar 18 15:19:09.134018 2020] [core:error] [pid 10656:tid 140336746033216] (EAI 2)Name or service not known: AH00547: Could not resolve host name www.toutic.com: -- ignoring!
AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled/toutic.com.conf:
Missing address for VirtualHost
Action 'configtest' failed.
The Apache error log may have more information.
here is the /etc/apache2/sites-enabled/toutic.com.conf file :
<VirtualHost *: 80>
ServerAdmin admin#toutic.com
ServerName toutic.com
ServerAlias www.toutic.com
DocumentRoot /var/www/toutic.com/public_html
ErrorLog ${APACHE_LOG_DIR
}/error.log
CustomLog ${APACHE_LOG_DIR
}/access.log combined
</VirtualHost>
here are the steps i followed : https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-debian-9
Remove everything and try like this:
<VirtualHost *:80>
ServerName toutic.com
ServerAlias www.toutic.com
DocumentRoot /var/www/toutic.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

How to fix Listen EADDRINUSE in ubuntu

How can I resolve this issue?
1|server | at listenInCluster (net.js:1327:12)
1|server | at Server.listen (net.js:1414:7)
1|server | at Object.<anonymous> (/root/signalmaster/server.js:41:8)
1|server | at Module._compile (internal/modules/cjs/loader.js:776:30)
1|server | at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
1|server | at Module.load (internal/modules/cjs/loader.js:653:32)
1|server | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
1|server | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
1|server | at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:27:21)
1|server | code: 'EADDRINUSE',
1|server | errno: 'EADDRINUSE',
1|server | syscall: 'listen',
1|server | address: '::',
1|server | port: 8080 }
My server and turnserver status is Online but our clients can't communicate or see each other.
UPDATE:
see this pm2 list
try in the console :
killall node
and the problem should be fixed
The following IP address already used. In same IP address you can run the server by different ports. The port must be opened.
* If it's live server and already running httpd .
<VirtualHost *:80>
ServerName api.xxxx.com
#DocumentRoot /var/www/test
CustomLog /var/www/test/access.log common
ErrorLog /var/www/test/error.log
UseCanonicalName Off
UserDir disabled
<Location "/">
ProxyPreserveHost On
ProxyPass http://localhost:8080/
ProxyPassReverse http://localhost:8080/
</Location>
</VirtualHost>

Amazon EC2 Error: listen EACCES 0.0.0.0:80

I have already added the HTTP TCP Port 80 to the inbound rules, but I still get the error:
Error: listen EACCES 0.0.0.0:80
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at Server.setupListenHandle [as _listen2] (net.js:1338:19)
at listenInCluster (net.js:1396:12)
at doListen (net.js:1505:7)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
You probably have to run your node.js script with sudo as you want to listen on port 80.
You cannot run a process that listens on low ports (below 1024) without root privileges.
You either try to run as sudo, as stated above, or start to use a reverse proxy (nginx for instance), start the process on another port and use the reverse proxy to forward the calls from port 80 to whatever port you started the process on.
The error code EACCES means you don't have proper permissions to run applications on that port. On Linux systems, any port below 1024 requires root access.
you need to use reverse proxy to forward the calls from port 80 to 8080 for example.

Socket.io on elastic beanstalk error

I get an error
http://lowcost-env.b8cgexs3tc.us-west-2.elasticbeanstalk.com/socket.io/?EIO=3&transport=polling&t=LliRJNu 404 (Not Found)
when I have deployed my app and try to run it. Socket.io works great locally on localhost.
My server-setup:
var server = require('http').Server(express);
var io = require('socket.io')(server);
server.listen(8080);
Client:
io.connect('LowCost-env.b8cgexs3tc.us-west-2.elasticbeanstalk.com')
The errorlog from Amazon show:
Error: listen EADDRINUSE :::8080
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at Server._listen2 (net.js:1259:14)
at listen (net.js:1295:10)
at Server.listen (net.js:1391:5)
at EventEmitter.listen (/var/app/current/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/var/app/current/server/index.js:8:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
Tue, 09 May 2017 11:30:38 GMT express-session deprecated undefined resave
option; provide resave option at server/app.js:27:9
Tue, 09 May 2017 11:30:38 GMT express-session deprecated undefined
saveUninitialized option; provide saveUninitialized option at server/app.js:27:9
In Amazon I have disabled proxy so I'm not using nginx. Whats the problem here?

Apache2 in Ubuntu - configuration domain - page not found

I have a project in Zend, in directory: /var/www/Project/public
A content of file httpd.conf is:
<VirtualHost 127.0.0.1:80>
DocumentRoot "/var/www/Project/public"
ServerName project.localhost
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/Project/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and /etc/hosts:
127.0.0.1 localhost
127.0.1.1 michal-centrala
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 project.localhost
When I go to page http://project.localhost i get the following error:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
The server log is following:
[Sun Jun 23 01:31:56 2013] [alert] [client 127.0.0.1] /var/www/Project/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Where's the problem?
Enable mod_rewrite in httpd.conf
Most likely line
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
is commented out
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Resources