2

AWS をいじっていて、無料利用枠の AWS アカウントに複数のアプリをデプロイしたいと考えています。

「ec-2-site.com/first-app」と「ec-2-site.com/second-app.

これが私の現在の構成ファイルです(基本的に、このrailscastから推測して確認します

upstream unicorn_chaos {
  server unix:/tmp/unicorn.chaos.sock fail_timeout=0;
}

upstream unicorn_blog {
  server unix:/tmp/unicorn.blog.sock fail_timeout=0;
}

server {
  listen 80 default deferred;

  location /chaos/ {
    #server_name http://ec2-50-16-81-170.compute-1.amazonaws.com/chaos;
    root /home/deployer/apps/chaos/current/public;

    location ^~ /assets/ {
      gzip_static on;
      expires max;
      add_header Cache-Control 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_chaos;
    }

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

  location /blog/ {
    # server_name example.com;
    root /home/deployer/apps/blog/current/public;

    location ^~ /assets/ {
      gzip_static on;
      expires max;
      add_header Cache-Control 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)blog;
    }

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

ここに私が得ているエラーがあります:

 nginx: [emerg] named location "@unicorn_chaos" can be on the server level only in /etc/nginx/sites-enabled/chaos:23

明らかに、その @unicorn_appname ディレクティブはそこにあるべきではありませんが、どこにあるべきでしょうか? 私はこれをすべて間違っているのでしょうか?

ありがとう

4

1 に答える 1