0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS ELB(ALB)で起きた謎現象(筆者がnginxの仕様を理解していない可能性あり)

Posted at

構成:
インターネット => ELB(ALB) => EC2 => nginx => puma => rails

参考サイト:
https://qiita.com/himatani/items/b6c267dfb330a47fea9f

こちらの参考サイトを元にnginxを設定

upstream puma {
    server unix:///var/www/my-app-name/shared/tmp/sockets/puma.sock;
}
server {
    listen       80;
    listen       [::]:80 default_server;
    server_name my.server.com;

    location / {
        proxy_pass http://puma;
    }
...

これで my.server.com にアクセスするとなぜか http://puma にリダイレクトし DNS_PROBE_FINISHED_NXDOMAIN になってしまう。
ちなみにserver_nameをec2のドメインに変えて直接アクセスすると問題なくアクセスできる。
(と思い込んでいる可能性は否めないけど)

で、これを以下のように修正したら動くようになった。
(かも)

upstream my.server.com {
    server unix:///var/www/my-app-name/shared/tmp/sockets/puma.sock;
}
server {
    listen       80;
    listen       [::]:80 default_server;
    server_name my.server.com;

    location / {
        proxy_pass http://my.server.com;
    }
...

もうちょっとちゃんと調べよう...

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?