By Milind1011
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 subdomain_server_ip, 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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
If you ping your domain name and you get the IP of your Droplet, this means that your DNS is set up correctly.
I believe that the problem must be with the Nginx configuration.
You could try to do the following:
sudo netstat -plant | grep 80
Feel free to share the output here.
sudo nginx -t
Status OK then try restarting Nginx to make sure that the latest changes that you’ve made are in place:systemctl restart nginx
I would guess that it could be the listen directive that might be causing the problem for you. Can you, as a test, try to change it from:
listen xx.xxx.xx.xxx:80 default deferred;
To:
listen 80 default deferred;
Basically that way if you run netstat again it would show you that nginx listens on 0.0.0.0:80 which means that it will accept connections from any IP and you should be able to access the service remotely.
Let me know how it goes! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.