简体   繁体   English

使用(unicorn和nginx)在rails app uri上部署sinatra app

[英]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.

相关问题 使用unicorn和nginx将另一个Rails应用程序部署到sub uri - Deploying another rails app to a sub uri with unicorn and nginx 使用Nginx,Unicorn,Postgres和Capistrano将Rails应用程序部署到Digital Ocean:Nginx eror - Deploying Rails app using Nginx, Unicorn, Postgres and Capistrano to Digital Ocean : nginx eror Nginx在子uri上托管单个Rails应用程序 - Nginx hosting a single Rails app on sub uri 将rails 3.2.12 app(带引擎)部署到nginx / passenger上的SUB URI时出现404 Not Found错误 - 404 Not Found error in deploying rails 3.2.12 app (with engines) to SUB URI on nginx/passenger OS X [Yosemite]:无法使用Nginx +独角兽运行Rails应用 - OS X [Yosemite] : cannot run rails app using nginx + unicorn 生产中在Nginx和Unicorn上运行的Rails 3应用程序未更新 - Rails 3 app running on Nginx and Unicorn in production not updating Rails应用程序内存泄漏:Nginx +独角兽 - Rails App Memory Leak: Nginx + Unicorn 在Thins上托管Rails应用,在子uri上托管Nginx,在反向代理后面 - Hosting Rails app on Thins, Nginx on a sub uri, behind a reverse proxy 使用capistrano将子域的Rails部署到nginx / unicorn设置-如何? - Deploying Rails with subdomains using capistrano to an nginx/unicorn setup — how? 在VPS上部署Rails应用程序时出现问题-无法加载此类文件-unicorn / launcher - Issue with Deploying a Rails app on VPS - cannot load such file — unicorn/launcher
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM