Trying to access application

Hello, I am trying to access an Adonis application that is on a Linux server (ubuntu 18.04), but I only get this error ERR_CONNECTION_REFUSED

I am running on port 3333 and already made sure it is released

I am using PM2 to run the application

My .env file looks like this:

HOST=localhost
PORT=3333
NODE_ENV=production
APP_URL=http://${HOST}:${PORT}

CACHE_VIEWS=false

APP_KEY=********
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=********
DB_PASSWORD=********
DB_DATABASE=********

SESSION_DRIVER=cookie
HASH_DRIVER=bcrypt

Does anyone have any idea why I am unable to access the application? NOTE: I already created a simple hello world in express to test it and I got access

1 Like

Can you run this command :

> pm2 logs

And can you share the content of your adonis log file

Only this appeared

Can you please share the error output?

2019-11-25T16:20:30: PM2 log: ===============================================================================
2019-11-25T16:20:30: PM2 log: — New PM2 Daemon started ----------------------------------------------------
2019-11-25T16:20:30: PM2 log: Time : Mon Nov 25 2019 16:20:30 GMT+0000 (UTC)
2019-11-25T16:20:30: PM2 log: PM2 version : 4.2.0
2019-11-25T16:20:30: PM2 log: Node.js version : 8.10.0
2019-11-25T16:20:30: PM2 log: Current arch : x64
2019-11-25T16:20:30: PM2 log: PM2 home : /home/usuario/.pm2
2019-11-25T16:20:30: PM2 log: PM2 PID file : /home/usuario/.pm2/pm2.pid
2019-11-25T16:20:30: PM2 log: RPC socket file : /home/usuario/.pm2/rpc.sock
2019-11-25T16:20:30: PM2 log: BUS socket file : /home/usuario/.pm2/pub.sock
2019-11-25T16:20:30: PM2 log: Application log path : /home/usuario/.pm2/logs
2019-11-25T16:20:30: PM2 log: Worker Interval : 30000
2019-11-25T16:20:30: PM2 log: Process dump file : /home/usuario/.pm2/dump.pm2
2019-11-25T16:20:30: PM2 log: Concurrent actions : 2
2019-11-25T16:20:30: PM2 log: SIGTERM timeout : 1600
2019-11-25T16:20:30: PM2 log: ===============================================================================
2019-11-25T16:20:31: PM2 log: App [server:0] starting in -fork mode-
2019-11-25T16:20:31: PM2 log: App [server:0] online
2019-11-25T16:21:18: PM2 log: Stopping app:server id:0
2019-11-25T16:21:18: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2019-11-25T16:21:18: PM2 log: pid=23910 msg=process killed
2019-11-25T16:25:22: PM2 log: App [server:0] starting in -fork mode-
2019-11-25T16:25:22: PM2 log: App [server:0] online
2019-11-25T16:25:40: PM2 log: [Watch] Start watching server
2019-11-25T16:25:40: PM2 log: Stopping app:server id:0
2019-11-25T16:25:40: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2019-11-25T16:25:40: PM2 log: pid=24244 msg=process killed
2019-11-25T16:25:40: PM2 log: App [server:0] starting in -fork mode-
2019-11-25T16:25:40: PM2 log: App [server:0] online
2019-11-25T16:28:37: PM2 log: [Watch] Stop watching server
2019-11-25T16:28:37: PM2 log: Stopping app:server id:0
2019-11-25T16:28:37: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2019-11-25T16:28:37: PM2 log: pid=24278 msg=process killed
2019-11-25T16:28:37: PM2 log: App [server:0] starting in -fork mode-
2019-11-25T16:28:37: PM2 log: App [server:0] online
2019-11-25T16:46:48: PM2 log: Stopping app:server id:0
2019-11-25T16:46:48: PM2 log: App [server:0] exited with code [0] via signal [SIGINT]
2019-11-25T16:46:48: PM2 log: pid=24460 msg=process killed
2019-11-25T17:07:31: PM2 log: App [server:0] starting in -fork mode-

Thx. How do you start application with pm2?
When you browse http://127.0.0.1:3333 what’s the output?

The application is on the server, I put [IP MACHINE]: 3333 to access it

image

Change HOST in your .env with the machine IP

Ok, now I get this xD

image

Try to change with the private IP of the machine

It’s safe to change host to 0.0.0.0 (make it listen to everything)
Or when you want to limit it more, then set it as your server IP (that won’t work with serverless and multi server clusters)

2 Likes

@vithorroot Just like @McSneaky said try setting HOST=0.0.0.0 in your .env file,
check also firewall ports … sudo ufw disable <- so you can try

Regards

This worked, thanks everyone!

1 Like