EC2上にRuby on Railsの環境を構築しております。
デプロイには、Opsworksを使っております。
別のプロジェクトでも同様の構成をとっており、問題なく稼働しているのですが、今回のプロジェクトはなぜか、
IPアドレスでブラウザアクセスした場合に、httpsにリダイレクトされてしまい、それによるエラーが発生しております。
nginx及びunicornは起動しております。
SSL関連の設定は何もしておらず、
Strict-Transport-Securityなども疑って調べていたのですが、
特に設定されてませんでした。
別プロジェクトでは問題がなかったので、何か設定ミスなのかなと思い、再三チェックをしているのですが、
特に問題がなさそうでしたので、余計にわかりません。(唯一相違なのが、別プロジェクトは半年前ほどに構築したものですので、Chefのバージョンが違っていたりする可能性があります。)
※ 以降、IPアドレス(54.xxx.xx.xxx)はマスキングさせていただいております。 curl -s --head 54.xxx.xx.xxx HTTP/1.1 301 Moved Permanently Server: nginx/1.10.1 Date: Thu, 19 Jan 2017 11:49:57 GMT Content-Type: text/html Connection: keep-alive Location: https://54.xxx.xx.xxx Vary: Origin
VPCやRoute53なども見ているのですが、特段変な設定もしておらず、かつ、こういうケースのデバッグ方法がわからず、
ここ1週間ぐらい彷徨っております。
開示できる情報は開示していきますので、どういった情報をみたらいいのか等、ご教示いただけないでしょうか?
ちなみにOpsworksでインスタンスを立てたログや、デプロイ時のログなども見ておりますが、エラーは発生しておらず、デプロイ自体も成功していることをsshした後に確認しております。
宜しくお願いします。
追記
nginx.confの中身も記載致します。
user nginx; worker_processes 10; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; gzip on; gzip_static on; gzip_http_version 1.0; gzip_comp_level 2; gzip_proxied any; gzip_types application/x-javascript application/xhtml+xml application/xml application/xml+rss text/css text/javascript text/plain text/xml; gzip_vary on; gzip_disable "MSIE [1-6].(?!.*SV1)"; client_max_body_size 4m; server_names_hash_bucket_size 64; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
追記
ls -ll /etc/nginx/ total 80 drwxr-xr-x 2 root root 4096 Jan 20 10:18 conf.d drwxr-xr-x 2 root root 4096 Aug 5 09:05 default.d -rw-r--r-- 1 root root 1077 Aug 5 09:05 fastcgi.conf -rw-r--r-- 1 root root 1077 Aug 5 09:05 fastcgi.conf.default -rw-r--r-- 1 root root 1007 Aug 5 09:05 fastcgi_params -rw-r--r-- 1 root root 1007 Aug 5 09:05 fastcgi_params.default -rw-r--r-- 1 root root 2837 Aug 5 09:05 koi-utf -rw-r--r-- 1 root root 2223 Aug 5 09:05 koi-win -rw-r--r-- 1 root root 3957 Aug 5 09:05 mime.types -rw-r--r-- 1 root root 3957 Aug 5 09:05 mime.types.default -rw-r--r-- 1 root root 788 Jan 19 17:41 nginx.conf -rw-r--r-- 1 root root 2656 Aug 5 09:05 nginx.conf.default -rw-r--r-- 1 root root 636 Aug 5 09:05 scgi_params -rw-r--r-- 1 root root 636 Aug 5 09:05 scgi_params.default drwxr-xr-x 2 root root 4096 Jan 19 18:24 sites-available drwxr-xr-x 2 root root 4096 Jan 19 18:24 sites-enabled drw------- 2 root root 4096 Jan 19 18:24 ssl -rw-r--r-- 1 root root 664 Aug 5 09:05 uwsgi_params -rw-r--r-- 1 root root 664 Aug 5 09:05 uwsgi_params.default -rw-r--r-- 1 root root 3610 Aug 5 09:05 win-utf
ls -ll /etc/nginx/conf.d/ total 4 -rw-r--r-- 1 root root 283 Aug 5 09:04 virtual.conf
/etc/nginx/conf.d/virtual.conf
# # virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #}
/etc/nginx/sites-enabled/hoge_app
listen 80; server_name hoge_app rails-app; access_log /var/log/nginx/hoge_app.access.log; keepalive_timeout 5; root /srv/www/hoge_app/current/public/; location / { try_files $uri/index.html $uri/index.htm @unicorn; } location @unicorn { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_read_timeout 60; proxy_send_timeout 60; # If you don't find the filename in the static files # Then request it from the unicorn server if (!-f $request_filename) { proxy_pass http://unicorn_hoge_app; break; } } location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } error_page 500 502 503 504 /500.html; location = /500.html { root /srv/www/hoge_app/current/public/; }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/01/20 01:55
2017/01/20 02:01
2017/01/20 04:11
2017/01/20 04:22
2017/01/21 11:16