Question

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

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


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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;