447

professional dilettante

Multiple Sinatra Apps with Nginx and Thin on Webfaction

I’ve been working on a Sinatra app to serve as a web development portfolio. I decided it is time to put it online using my shared host, Webfaction. Here in this post, I’m not going to go over all the steps to set up a Sinatra app. You can find my tutorial on that here: [...]

I’ve been working on a Sinatra app to serve as a web development portfolio. I decided it is time to put it online using my shared host, Webfaction. Here in this post, I’m not going to go over all the steps to set up a Sinatra app. You can find my tutorial on that here: Sinatra on Webfaction.

However, here I just wanted to discuss how I added a second Sinatra app on Webfaction. As a sys admin noob, it was not immediately obvious to me. After some thinking, I realized I could use my existing Nginx custom app. As I said… admittedly a noob.

And so the steps became:

Open a port for running Thin by creating a custom app in the webfaction control panel.
Make a custom app (“Custom app listening on port”) in the webfaction control panel. Name this app whatever your Sinatra app will be called. This app will show up in ~/webapps/APP_NAME.

Choose a domain/URL and add it to your existing Site being served by the Nginx App.
In the webfaction control panel, under Sites, if you are adding a second Sinatra app, then you already have a site being served by Nginx. You just need to add the domain/url for your app to the existing Site that is running your first Sinatra app.

Modify your ~/webapps/nginx/conf/nginx.conf
Add a new upstream app_name { } block and another server { } block.

Restart Nginx

[ ~/webapps/nginx]$ ps -u zhannes
20052 ?        00:00:00 nginx
[ ~/webapps/nginx]$ kill 20052
[ ~/webapps/nginx]$ ./sbin/nginx

Make Sinatra app, rackup file, and create a yml file for Thin to read
Start Thin

Be done and happy.

Leave a Reply

Required fields are marked with an asterisk (*), you may use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free

Most Recent Post

It’s been a long time, I shouldn’t have left you, part 1 …

But now I’m back.All official like.I do social stuff again.I see my friends.I’m moving into my own place again.And all that adult shit.

Categories

Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes

Entries (RSS)
Comments (RSS)

22 queries.
0.493 seconds.