【发布时间】:2019-06-30 15:47:37
【问题描述】:
我已经检查了许多 stackoverflow,但需要有一个正确的答案来说明如何做到这一点。
我有 2 个(ubuntu)服务器,它们配置了 nginx、puma 和 capistrano,以服务于各自的 rails 应用程序。 为了节省成本,我希望它只托管在一台服务器上。
这里有一些链接,但不清楚需要做什么:
Setting up multiple rails apps using nginx and Puma is it possible to have multiple project of rails on same port?
我的服务器 nginx.conf(用于第一个应用程序):
upstream pumawebapp {
server unix:///home/user1/apps/webapp/shared/tmp/sockets/webapp-puma.sock;
}
server {
listen 80;
server_name webapp.org www.webapp.org;
return 301 https://webapp.org$request_uri;
}
server {
listen 443;
server_name webapp.org;
ssl on;
ssl_certificate /etc/ssl/webapp_bundle.crt;
ssl_certificate_key /etc/ssl/webappserver.key;
root /home/user1/apps/webapp/current/public;
access_log /home/user1/apps/webapp/current/log/nginx.https.access.log;
error_log /home/user1/apps/webapp/current/log/nginx.https.error.log info;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @pumawebapp;
location @pumawebapp {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://pumawebapp;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 10M;
keepalive_timeout 10;
}
我需要了解如何能够在我拥有的当前 puma + nginx 环境中的服务器中托管 2 个 rails 应用程序(单独的域)。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 nginx puma