[英]Deploying sinatra app on rails app sub uri using( unicorn and nginx)
I have rails app running on unicorn+nginx. 我在独角兽+ nginx上运行rails应用程序。 below is the nginx.conf and unicorn.rb configuration.
下面是nginx.conf和unicorn.rb配置。
nginx.conf 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;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
unicorn.rb 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).
现在我想部署另一个小的sinatra应用程序rails app 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.
详细信息:我们知道在localhost:3000上运行的rails应用程序,现在我正在尝试在localhost:3000 / sinatraapp上配置sinatra应用程序。
Please suggest me, How will i configure above requirement. 请建议我,我将如何配置上述要求。
您只需在Rails的routes.rb
安装Sinatra应用程序:
mount SinatraApp, :at => "/sinatraapp"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.