I am trying to transfer my domain. I am running my rails app using this command from my rails folder
RAILS_ENV=production rails s --binding=128.199.95.219
However, I can only access it through http://128.199.95.219:3000/ but not http://128.199.95.219/.
I might be wrong but I think I need to somehow serve my app from the root domain address like http://128.199.95.219/ not http://128.199.95.219:3000/. I have already point my domain name to DigitalOcean by following this tutorial And I have also setup the host name with DigitalOcean. So right now I just need to configure rails, nginx, and unicorn somehow to serve my app at the domain address or http://128.199.95.219/ (I don’t even know if that is what I need to do. so please help me!)
I am running Ubuntu 14.04 with rails, nginx, and unicorn. I’ve configured my nginx and unicorn according to this tutorial here
How do I make rails application accessible from the root of the domain address (http://128.199.95.219/)? or is that eve necessary at all?
How exactly do I deploy my rails application? I am lost! Please help!
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!
You need to use nginx to proxy HTTP requests to whatever port unicorn is running on. In this specific case that is port 3000.
When you go to any website using a web browser by default http://website.com is actually just sending a request to the IP address at website.com on port 80. Likewise, when you go to https://website.com it is sending a request to that IP address at website.com on port 443.
So, in your case you have unicorn running on port 3000, and you need to get nginx to listen on port 80 and proxy all requests to port 3000.
SSH into your server
Edit the nginx config file
nano /etc/nginx/sites-available/default
Replace everything in there with this:
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Restart nginx service nginx restart
You should now be able to access your rails app at both 128.199.95.219 and assuming you have an A record for YOUR_WEBSITE.COM pointed to 128.199.95.219 then you should also be able to access the app at http://YOUR_WEBSITE.COM
Hope this helps!
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.