Nginx setup with SSL on Ruby app running Passenger

Once you’ve got your certs all setup you can add an entry to /etc/nginx/sites-available and then symlink it to /etc/nginx/site-enabled

An example snippet below:

server {
        listen 443;
        ssl on;
        ssl_certificate         /home/deploy/.ssl/mydomain_combined.crt;
        ssl_certificate_key     /home/deploy/.ssl/mydomain.key;

        passenger_enabled on;
        rails_env    production;
        root         /home/deploy/apps/my-app/current/public;
        passenger_ruby /home/deploy/.rvm/gems/ruby-2.2.2@my-app/wrappers/ru$

        access_log /home/deploy/apps/my-app/current/log/access.log;
        error_log /home/deploy/apps/my-app/current/log/error.log;

        # redirect server error pages to the static page /50x$
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;