This post is very quick guide about how to deploy ruby on rails application on AWS cloud running apache2 webserver. Deploying application means putting it on a Web server so that it can be used either through the Internet or an intranet. This Web server might be local UNIX system, while you develop and debug your application to check its working or a AWS cloud server.


System Pre-requisites

  1. Server (VM or physical) accessible and  ssh setup for deployment
  2. You need app which ready to go server ( Normal app ,Docker, Container )
  3. Web app server just like (apache, nginx) also you need your passenger mod for assist
  4. Ruby, rail, gems installed
  5. Last your required database which you want to use (MySQL, SQLite etc.)

Steps To Deploy Rails App on AWS Server

$ sudo apt update
$ sudo apt install apache2 libapache2-mod-passenger
$ sudo vim /etc/apache2/sites-enabled/000-default.conf
Apache configuration for ruby on rails application
$ sudo a2enmod passenger
Passenger mod working with RoR application
$ sudo a2dissite 000-default.conf
$ sudo a2ensite new_site.conf

Troubleshooting Ruby App deployment errors

Apache not working properly due to syntax error in apache2.conf

Fix syntax errors and restart apache

Passenger Mod not working properly

uninstall passenger mod and re-install it and configure passenger.conf file

$ sudo apt purge libapache2-mod-passenger
$ sudo apt install libapache2-mod-passenger

Hope you have enjoyed reading this quick guide on How to Deploy Rails App on AWS Server running apache with passenger.