Configure subdomain in NGINX with rails

0

I'm uploading a Ruby on Rails application to DigitalOcean, and I need it to stay in a subdomain, I've already set up DNS and it's working.

The application works in the primary domain. But the subdomain does not work.

I'm using NGINX and the file is linked in / etc / nginx / sites-enabled / ApplicationApp_production.

With two "server" nodes, the first one should redirect to the application using the subdomain and the second one is working by sending to a simple html.

Is there any further configuration for the subdomain to work? Do I need to configure the subdomain in DNS or is it only in the same NGINX?

upstream puma_AplicativoApp_production {
  server unix:/var/www/aplicativo_app/shared/tmp/sockets/puma.sock fail_timeout=0;
}
# aqui a configuração do subdomínio, que deveria levar para a aplicação
server {
  listen 80;
  server_name local1.appaplicativo.net;
  root /var/www/aplicativo_app/current/public;
  try_files $uri/index.html $uri @puma_AplicativoApp_production;

  client_max_body_size 4G;
  keepalive_timeout 10;

  error_page 500 502 504 /500.html;
  error_page 503 @503;

  location @puma_AplicativoApp_production {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_redirect off;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header X-Forwarded-Proto http;
    proxy_pass http://puma_AplicativoApp_production;
    # limit_req zone=one;
    access_log /var/www/aplicativo_app/shared/log/nginx.access.log;
    error_log /var/www/aplicativo_app/shared/log/nginx.error.log;
  }

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  location = /50x.html {
    root html;
}

  location = /404.html {
    root html;
  }

  location @503 {
    error_page 405 = /system/maintenance.html;
    if (-f $document_root/system/maintenance.html) {
      rewrite ^(.*)$ /system/maintenance.html break;
    }
    rewrite ^(.*)$ /503.html break;
  }

  if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
    return 405;
  }

  if (-f $document_root/system/maintenance.html) {
    return 503;
  }
}

# aqui a configuração do domínio principal, que leva para um arquivo HTML simples
server {
  listen 80;
  server_name appaplicativo.net;
  root /var/www/html;
  index index.html index.htm;

  location / {
    try_files $uri $uri/ =404;
  }
}
    
asked by anonymous 15.10.2018 / 22:50

0 answers