Report this

What is the reason for this report?

How do I set-up reverse proxying with a Ruby Rack app?

Posted on March 16, 2015
Apop

By Apop

Are there any good link/resources deploying a Rack app(Not rails!).

So far I have the Rack app set-up with the folders and such but I have been having LOTS of trouble with the nginx part so I uninstalled and decided to try again.

Maybe someone here give me a good dumbed-down version to do this task?

Thanks in advance



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!

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.

Sure thing! Here is the simplified setup for nginx as a proxy to your ruby app.

Install nginx:

apt-get update;
apt-get install nginx

Then in your main virtualhost configuration: /etc/nginx/sites-enabled/default

Replace the existing Location / block with the following:

location / {
    proxy_pass       http://localhost:4567;
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
}

Making sure to change 4567 to the port your app is running on if it is different. Then restart nginx so your changes will take effect:

service nginx restart;

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.