Skip to content

Subdomain with Nginx example below not working #7360

@ademir10

Description

@ademir10

Hi guys! I'm trying to find some example about to make a simple subdomain Nginx config but unfortunately i can't find any example to make it works in my project.

Basically i have a subdomain: bola.mytab.com.br
running in a custom port using this command:
rails lift --prod --port 3012

and after to install my certbot in a available sites with the same name: bola.mytab.com.br i also configured my nginx file this way:
could you help me please? thank you so much!

upstream app {
server http://127.0.0.1:3012;
}
server {

    server_name bola.mytab.com.br;
location /app/ {
     proxy_pass http://127.0.0.1:3012;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto https;
     proxy_set_header X-Forwarded-Server $host;
     proxy_set_header Host $http_host;
     proxy_redirect off;
    }

    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/bola.mytab.com.br/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/bola.mytab.com.br/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 = bola.mytab.com.br) {
return 301 https://$host$request_uri;
} # managed by Certbot

    listen 80;
    server_name bola.mytab.com.br;
return 404; # managed by Certbot

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions