Ask A Question


You’re not receiving notifications from this thread.

How to manage upstream with ssl?

naveen kumar asked in Rails

I am trying to deploy with nginx puma using upstream so
should i use ssl connection with my upstream https://my_app

upstream my_app {
server; # or the port you configured in puma configuration file

server {
listen 443 ssl ;

    ssl_certificate /etc/ssl/certs/2020.crt;
    ssl_certificate_key /etc/ssl/private/2020.key;
    #ssl_dhparam /etc/ssl/certs/dhparam.pem;

    server_name ;

    root /var/www/vhosts/;

            location / {
                    proxy_pass http://my_app; # match the name of upstream directive which is defined above
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            location ~* ^/assets/ {
                    # Per RFC2616 - 1 year maximum expiry
                    expires 1y;
                    add_header Cache-Control public;

                    # Some browsers still send conditional-GET requests if there's a
                    # Last-Modified header or an ETag header even if they haven't
                     # reached the expiry date sent in the Expires header.
                    add_header Last-Modified "";
                    add_header ETag "";
           location /cable {
                    proxy_pass http://my_app;
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,111+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.