0
I’m uploading a Ruby on Rails app on Digitalocean, and I need it to stay in a Ubdomain, I’ve already configured DNS and it’s working.
the application works in the main domain. But in Ubdomain it does not work.
I am using NGINX and the file is linked in /etc/Nginx/sites-enabled/Aplicativoapp_production.
With two "server" nodes, the first should redirect to the application using the subdomain and the second is working by sending to a simple html.
Are there any other settings for Subdomain to work? I need to configure Subdomain on DNS or is only on NGINX itself?
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;
}
}
If you do not use the wildcard in the *Nginx configuration, it is necessary to add the subdomain in the settings of DNS.
– Valdeir Psr
I added the Domain straight on dns, I think DNS only needed to propagate, hj dawn working :)
– Carlos Fagiani Jr
Good that everything is OK. Errata for someone who say a similar question: Wildcard is in the DNS configuration and not in Nginx.
– Valdeir Psr