Question
Rails 5 application(nginx/puma) with Subdomain is not working even after adding the A Records.
HI,
I have recently setup the main domain, for example…domain.com(new droplet) on rails 5 and it got deployed and live successfully.
Now I want to use subdomain.domain.com, which is an distinct application(added new droplet) using the same domain name and hence i have also added required entries in the Domain setting as shown below.
I have just renamed my subdomain and domain to default names -
in domain.com settings - 2A RECORDS/3NS RECORDS
Hostname | Value
------------- | -------------
subdomain.domain.com | new_droplet_ip_subdomain
domain.com | droplet_ip_domain
domain.com | ns1,ns2,ns3 entires(rented from godaddy)
also added subdomain.domain.com …settings
(Type)Hostname | Value
------------- | -------------
(cname)*.subdomain.domain.com | subdomain.domain.com
(a record)domain.com | droplet_ip_domain
3 ns records | ns1,ns2,ns3 entires(rented from godaddy)
Moreover there is also a PTR record for -
IPADRESS | PTR Record
-------------------------------------
sub_domain_ip_address | subdomain.domain.
MOrover, there is firewall open to all ports
Type Protocol Port Range Sources
SSH TCP 22 All IPv4 All IPv6 More
HTTP TCP 80 All IPv4 All IPv6 More
HTTPS TCP 443 All IPv4 All IPv6 More
Custom TCP 2812 All IPv4 All IPv6 More
I am not able to understand why its still failing as I cannot see a single log generated in the subdomainserverip, where deployment is successful.I am sure, I am making some mistake in the DNS, but what is that.I have also referred DNS details for Digital Ocean but still when I hit subdomain.domain.com on browser, it just keeps loading and stops saying that subdomain.domain.com took too long to respond.
I already have successfully deployed domain.com and its working great.
So,
1- do i need to update hosts file?..i did but still the same
2- when I ping - ping subdomain.domain.com
, it works and packets are received.
3- NO logs are generated on the subdomain.domain.com server, when I login using ssh user@ip, nginx and puma is working and started, but no logs.
4- On the browser, when I hit subdomain.domain.com, it get subdomain.domain.com took too long to respond
.
5- my /etc/nginx/sites-enabled/subdomain.domain.com
file looks like shown below: –
upstream puma {
server unix:///home/mike/apps/domain/shared/tmp/sockets/domain-puma.sock;
}
server {
listen xx.xxx.xx.xxx:80 default deferred;
server_name www.subdomain.domain.com, subdomain.domain.com;
root /home/mike/apps/domain/current/public;
access_log /home/mike/apps/domain/current/log/nginx.access.log;
error_log /home/mike/apps/domain/current/log/nginx.error.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @puma;
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://puma;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
Can somebody help or give me some ideas as what is missing.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×