Reputation: 687
I am trying to setup my own Ghost blog server on AWS EC2 instance. After I start Ghost on the remote server under root user. I tried to open it on my local browser.
ubuntu@ip-172-31-45-199:~/Ghost$ sudo npm start
> [email protected] start /home/ubuntu/Ghost'
> node index
Migrations: Up to date at version 003
Ghost is running in development...
Listening on 127.0.0.1:2368
Url configured as: http://localhost:2368
Ctrl+C to shut down
When I put the public DNS followed by port 2368 which is the Ghost's default port number. It can't display the page.
I already set the security group and open SSH alltcp alludp http https. I don't why maybe I didn't configure it. I search a lot but can't find a useful solution. Any one can give some advice?
Upvotes: 0
Views: 540
Reputation: 471
When Ghost started up it said that it was listening for requests that come from 127.0.0.1:
Listening on 127.0.0.1:2368
Update your config.js file so that it will listen to requests coming from anywhere. To do that change:
host: '127.0.0.1',
to
host: '0.0.0.0',
As Norman stated it is uncommon to have a Node.js application listening on port 80. It is more common for people to configure either Apache or Nginx to listen on port 80 and then proxy the requests to port 2368, where Ghost will be listening.
You can see some steps to configure Nginx or Apache in my posts:
http://www.allaboutghost.com/how-to-proxy-port-80-to-2368-for-ghost-with-apache/
http://www.allaboutghost.com/how-to-proxy-port-80-to-2368-for-ghost-with-nginx/
Upvotes: 0
Reputation: 6957
Usually, NodeJS applications are set behind a proxy server such as Nginx which run on port 80. All http traffic is allowed to go through this port only. In your case, I think you are running Ghost as a standalone server without any proxy server in front so you will need to run it on port 80 instead of port 2368. This requires root privileges but I think that should not be a problem for you.
Also, your EC2 security group should allow http traffic through.
Lastly, your Ghost configuration should reflect the proper url instead of http:/localhost...
Upvotes: 1