Deploy ruby code via nginx

November 10, 2017 651 views
Nginx Ubuntu 16.04

I have an existing website that I am trying to set up a test server for.

I have a digital ocean droplet and have installed nginx on it. Right now I get the default 'welcome to nginx' message, I am not sure how to modify my nginx.conf file to deploy the site I have on my droplet. I see that I have nginx, ruby and postgres running when I enter netstat -tpln but I don't know what changes I have to make to my nginx.conf file to have the site run.

Here is my nginx.conf file (some parts removed for brevity):

user www-data; 
worker_processes 3; 
pid /run/nginx.pid; 

events { 
        worker_connections 768; 
        # multi_accept on; 
} 

http { 

        server {
            listen 80 default_server;
            listen [::]:80 default_server ipv6only=on;
            server_name ultimaterehabestimator.com;

            location / {
                return 301 https://ultimaterehab.charstarstar.com$request_uri;
            }
        }
server {

    # SSL configuration

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;
    include snippets/self-signed.conf;
    include snippets/ssl-params.conf;
}
        server {
            listen 443 ssl;
            listen [::]:443 ssl;
            server_name backend.ultimaterehabestimator.com;

            ssl_certificate /etc/letsencrypt/live/ultimaterehab.charstarstar.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/ultimaterehab.charstarstar.com/privkey.pem;
            ssl_trusted_certificate /etc/letsencrypt/live/ultimaterehab.charstarstar.com/fullchain.pem;

            location / {
                proxy_pass http://127.0.0.1:4567;
            }
        }
        server {
            listen 5000 ssl;
            listen [::]:5000 ssl;
            server_name backend.ultimaterehabestimator.com;

            ssl_certificate /etc/letsencrypt/live/ultimaterehab.charstarstar.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/ultimaterehab.charstarstar.com/privkey.pem;
            ssl_trusted_certificate /etc/letsencrypt/live/ultimaterehab.charstarstar.com/fullchain.pem;

            location / {
                proxy_pass http://127.0.0.1:4567;
            }
        }

        server {
            listen 444 ssl;
            listen [::]:444 ssl;
            server_name ultimaterehab-backend.charstarstar.com;

            ssl_certificate /etc/letsencrypt/live/ultimaterehab-backend.charstarstar.com/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/ultimaterehab-backend.charstarstar.com/privkey.pem;
            ssl_trusted_certificate /etc/letsencrypt/live/ultimaterehab-backend.charstarstar.com/fullchain.pem;

            location / {
                proxy_pass http://127.0.0.1:5000;
            }
        }
}
Be the first one to answer this question.