Rails application not loading after deploy to EC2 using Capistrano
I setup an Amazon EC2 Ubuntu 14.04 instance and deployed my Rails application using Capistrano with Passenger in Apache following the guide in Passenger website, tried to follow everything stated except that I have different app name and directory: /var/www/<my_app_name>.
After some configurations the deployment has finally success and when I try running Rails console in my app folder it's working fine, but when I try to access my app through IP address in web browser it does not load at all, browser returning ERR_CONNECTION_TIMED_OUT error. I have restarted Apache several times but it's still not working. Maybe something is missing out or configuration error with Apache/Passenger.
This is my Apache error log from /var/log/apache2/error.log:
[ 2015-11-24 14:20:25.7238 18152/7f3199f9d700 Ser/Server.h:444 ]: [UstRouter] Shutdown finished [ 2015-11-24 14:20:25.7239 18152/7f31a07ab7c0 age/Ust/UstRouterMain.cpp:498 ]: Passenger UstRouter shutdown finished [ 2015-11-24 14:20:25.7306 18230/7f2bca98a7c0 age/Wat/WatchdogMain.cpp:1276 ]: Starting Passenger watchdog... [ 2015-11-24 14:20:25.7394 18233/7f7e579cd7c0 age/Cor/CoreMain.cpp:957 ]: Starting Passenger core... [ 2015-11-24 14:20:25.7395 18233/7f7e579cd7c0 age/Cor/CoreMain.cpp:234 ]: Passenger core running in multi-application mode. [ 2015-11-24 14:20:25.7408 18233/7f7e579cd7c0 age/Cor/CoreMain.cpp:707 ]: Passenger core online, PID 18233 [ 2015-11-24 14:20:25.7463 18242/7f9e135ba7c0 age/Ust/UstRouterMain.cpp:504 ]: Starting Passenger UstRouter... [ 2015-11-24 14:20:25.7469 18242/7f9e135ba7c0 age/Ust/UstRouterMain.cpp:317 ]: Passenger UstRouter online, PID 18242 [Tue Nov 24 14:20:25.747329 2015] [mpm_event:notice] [pid 17566:tid 139962846635904] AH00489: Apache/2.4.7 (Ubuntu) Phusion_Passenger/5.0.21 configured -- resuming normal operations [Tue Nov 24 14:20:25.747348 2015] [core:notice] [pid 17566:tid 139962846635904] AH00094: Command line: '/usr/sbin/apache2'
While my access.log is empty.
This is my app configuration for Apache in /etc/apache2/sites-enabled/my_app.conf:
<VirtualHost *:80> ServerName <my_ip_address> # Tell Apache and Passenger where your app's 'public' directory is DocumentRoot /var/www/my_app/current/public PassengerRuby /usr/local/rvm/rubies/ruby-2.2.1/bin/ruby # Relax Apache security settings <Directory /var/www/my_app/current/public> Allow from all Options -MultiViews Require all granted </Directory> </VirtualHost>
Any help is much appreciated. Thanks in advance.
Update 1: When I tried to see the status of Passenger using passenger-status:
Phusion Passenger is currently not serving any applications.
I tried to get my application hooked to Passenger by touching restart.txt like so:
$sudo touch /var/www/my_app/current/tmp/restart.txt
But it's not working.
The problem is on instance settings as pointed out in this SO question. EC2 instance is not allowing public HTTP access by default:
- Click Instances in ec2 page navigation tab
- Scroll through your instance record to find the security group. Click on the security group.
Select "Inbound" tab for the security group and make sure the following rule exists.
HTTP TCP 80 0.0.0.0/0