digitalocean / nginxconfig.io

⚙️ NGINX config generator on steroids 💉
https://do.co/nginxconfig
MIT License
27.72k stars 2.04k forks source link

Who can help with deploy setup? #269

Closed Kasvit closed 3 years ago

Kasvit commented 3 years ago

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/airstage.co.conf (it was chenged by certbot)

server {
    server_name airstage.co www.airstage.co;
    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/airstage.co/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/airstage.co/privkey.pem; # 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 = www.airstage.co) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    if ($host = airstage.co) {
        return 301 https://$host$request_uri;
    } # managed by Certbot
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name airstage.co www.airstage.co;
    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/airstage.co.conf

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

Rails application, deployed by capistrano

MattIPv4 commented 3 years ago

👋 If you're looking for help with nginx configurations in general, I'd recommend posting on the DigitalOcean Community Q&A, where there are many folks that might be able to help you!

GitHub issues are meant for reporting issues specifically with the nginxconfig tool itself.