subdomain rails nginx unicorn怎么样?

时间:2013-09-18 11:05:39

标签: ruby-on-rails nginx capistrano unicorn

我正在尝试在子域中使用新的rails应用程序,我尝试了一些,我无法解决它。

我有子域名xxx.domain.com 我正在努力建立新的子域名yyy.domain.com

这是我的nginx配置文件

upstream unicorn1 {
server unix:/tmp/unicorn.xxx.sock fail_timeout=0;
}
upstream unicorn2 {
  server unix:/tmp/unicorn.yyy.sock fail_timeout=0;
}
server {
  listen 80;
  server_name xxx.domain.com;
  root /home/ubuntu/apps/xxx/current/public;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @unicorn1;
  location @unicorn1 {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://unicorn1;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;

}
server {
  listen 80;
  server_name yyy.domain.com;
  root /home/ubuntu/apps/yyy/current/public;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @unicorn2;
  location @unicorn2 {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://unicorn2;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;

}

其他子域名,即yyy.domain.com始终显示网站xxx.domain.com

如何指向yyy.domain.com查看我的应用程序?

请帮我解决这个问题。

0 个答案:

没有答案