# Deploying sinatra app on rails app sub uri using( unicorn and nginx)

**URL:** <https://www.ruby-forum.com/t/deploying-sinatra-app-on-rails-app-sub-uri-using-unicorn-and-nginx/235714>\
**Category:** NGINX\
**Created:** [July 10, 2013, 11:15pm UTC](https://www.ruby-forum.com/t/deploying-sinatra-app-on-rails-app-sub-uri-using-unicorn-and-nginx/235714 "2013-07-10T23:15:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [July 10, 2013, 11:15pm UTC](https://www.ruby-forum.com/t/deploying-sinatra-app-on-rails-app-sub-uri-using-unicorn-and-nginx/235714/1 "2013-07-10T23:15:41Z")

</div>

I have rails app running on unicorn+nginx. below is the nginx.conf and  
unicorn.rb configuration.

nginx.conf

upstream unicorn {  
server unix:/tmp/unicorn.todo.sock fail\_timeout=0;  
}

server{  
listen 80 default deferred;  
#server\_name localhost;  
root /var/www/demo/public;  
try\_files $uri/index.html $uri @unicorn;

location @unicorn {  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header Host $http\_host;  
proxy\_redirect off;  
proxy\_pass [http://unicorn](http://unicorn);  
}

error\_page 500 502 503 504 /500.html;  
client\_max\_body\_size 4G;  
keepalive\_timeout 10;  
}

unicorn.rb

working\_directory “/var/www/demo”  
pid “/var/www/demo/tmp/pids/unicorn.pid”  
stderr\_path “/var/www/demo/unicorn.log”  
stdout\_path “/var/www/demo/unicorn.log”

listen “/tmp/unicorn.todo.sock”  
worker\_processes 2  
timeout 30

It’s working fine for me. Now i wanted to deploy another small sinatra  
app  
rails app sub uri(localhost:3000/sinatraapp). DETAILS: As we know rails  
app  
running on localhost:3000, Now i am trying to configure sinatra app on  
localhost:3000/sinatraapp.

Please suggest me, How will i configure above requirement.

Posted at Nginx Forum:

> **[Deploying sinatra app on rails app sub uri using( unicorn and nginx)](https://forum.nginx.org/read.php?2,240739,240739#msg-240739)**
>
> I have rails app running on unicorn+nginx. below is the nginx.conf and unicorn.rb configuration. nginx.conf upstream unicorn { server unix:/tmp/unicorn.todo.sock fail\_timeout=0; } server{ listen 80 default deferred; #ser
