By agarcia1
I have a domain registered that’s pointing to my rails app. That’s working all well and good. I decided to add a second rails app that I wanted a subdomain to point to.
I setup up second nginx server block with the server_name set to mysubdomain.mydomain.com and I setup my A record for my subdomain that’s pointing to the same droplet that my domain is pointing to, and I set the root for my second app to the public folder of my seconds rails app (in my /etc/nginx/sites-enabled/secondrailsapp file)
When I enter the subdomain in the url bar, I just get the regular website, as if I was only entering the domain. However, the subdomain is still in the URL so I know it’s setup, it’s just not pointing to the correct app. Any ideas?
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,
It sounds like that your DNS was setup correctly. I believe that it is either an issue with your Nginx configuration or file permissions problem.
What I would suggest is:
nginx -t
Syntax OK then restart Nginx:systemctl restart nginx
Then test your site again. If this is still not working, then I would recommend making sure that your root directory for your second domain has the correct ownership:
chown -R nginx:nginx /var/www/second_rails_app
Then test the site again, try to clear the cache of your browser before testing the site.
If this still does not work, I would recommend sharing your Nginx server blocks here so that I could advise you further.
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.