在单个服务器上的多个应用程序的轨道(2个独立的结构域) - 美洲狮和nginx的

问题描述 投票:0回答:1

我已经检查过很多计算器,但需要有关于如何做到这一点正确的答案。

我有经配置以与nginx的,PUMA和Capistrano的投放相应的滑轨应用程序2(ubuntu的)服务器。为了节省成本,我想必须有它托管在一个服务器上。

这里有一些联系,但其并不清楚需要做什么:

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
1个回答
0
投票

你只需要创建另一个nginx的服务器与其他服务器名

server {
  listen 80;
  server_name webapp2.org www.webapp2.org;
  return 301 https://webapp2.org$request_uri;
}

不要使用SSL同样为这个新的服务器。

© www.soinside.com 2019 - 2024. All rights reserved.