How to set up rails app with Nginx/Capistrano

Hi all, sorry for this stupid question but I don’t know how to figure out this issue. I can’t run my app after changed SSL to certbot.

My NGINX config: /etc/nginx/conf.d/ (it was chenged by certbot)

server {
    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
server {    
    if ($host = {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    if ($host = {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    listen 80 default_server;
    listen [::]:80 default_server;
    return 404; # managed by Certbot

And here /etc/nginx/sites-available/default

upstream app {
  server unix:///home/deploy/airstage_web/shared/tmp/sockets/puma.sock fail_timeout=0;
server {
        root /home/deploy/airstage_web/current/public;
        try_files $uri/index.html $uri @app;
        location /home/deploy/airstage_web/current/public {
          autoindex on;
          autoindex_exact_size off;
        location @app {
                        proxy_pass http://app;
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_buffer_size 128k;
                proxy_buffers 4 256k;
                proxy_busy_buffers_size 256k;
        location ^~ /assets/ {
                gzip_static on;
                expires max;
                add_header Cache-Control public;
        error_page 500 502 503 504 /500.html;
        client_max_body_size 1G;
        keepalive_timeout 10;

This all returned me Welcome to nginx! page or if I moved root path nginx/conf.d/

[error] 14714#14714: *763 directory index of "/home/deploy/airstage_web/current/public/" is forbidden, client: My_IP, server:, request: "GET / HTTP/1.1", host: ""

My web server is (include version): nginx/1.10.3 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 16.04

Domain: GoDaddy.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer