By amirhb
I’ve transferred all files to my droplet. mydomain.com is still not responding. I assume it’s because the Sinatra server isn’t running. How can I resolve this?
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!
To deploy a sinatra app you will need to do the following:
1.) Install the sinatra gem with:
gem install sinatra
If you encounter errors building the gem you may need to install some additional libraries and tools:
apt-get update
apt-get install ruby-dev build-essential
2.) Install Nginx to act as a proxy between your app and the public Internet on port 80.
apt-get install nginx
3.) Edit your nginx configuration file /etc/nginx/sites-enabled/default Something like the following should be used to replace the default Location / block:
location / {
proxy_pass http://localhost:4567;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
4.) Now restart nginx and start your sinatra app.
service nginx restart
ruby myapp.rb
Your app will now be up and running and available via a web browser.
Since Ruby will run in the console you may want to use screen to keep the app running in the background once you disconnect. To do this first install screen if it is not already there:
apt-get install screen
Then start a new screen session:
screen -S "My App"
and run your app within the session:
ruby myapp.rb
Once it’s up and running you can disconnect from the screen session by pressing **Ctrl+a" and then “d”
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.