・Rails(puma)
・nginx
・let's encrypt
という構成で、https化させようとしております。
httpでの動作確認はできております。
let's encryptの発行も完了しており、nginxに記載をしております。
httpsのポートもあいており、
rails側では
config/environments/production.rb
にある、
force_ssl もtrueにしております。
ただ、httpsでアクセスしても
「このサイトにアクセスできません」と表示されます。
どこかの設定に不備があるのですが、その原因のきりわけに困っております。
宜しくお願い致します。
起動方法は、以下のコマンドを実行
$ puma -C config/puma.rb -e production
設定情報
/etc/nginx/conf.d/sample_app.conf
※ /etc/letsencrypt/live/sample_app/fullchain.pem などのファイルは実際に存在していることを確認しております。sample_appの部分は実際のサービスのドメイン名になっております。
upstream my_app { server unix:///var/run/puma/my_app.sock; } log_format healthd '$msec"$uri"' '$status"$request_time"$upstream_response_time"' '$http_x_forwarded_for'; server { listen 80; server_name sample_app; # need to listen to localhost for worker tier return 301 https://$host$request_uri; } server { listen 443 ssl; ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers 'kEECDH+ECDSA+AES128 kEECDH+ECDSA+AES256 kEECDH+AES128 kEECDH+AES256 kEDH+AES128 kEDH+AES256 DES-CBC3-SHA +SHA !aNULL !eNULL !LOW !kECDH !DSS !MD5 !EXP !PSK !SRP !CAMELLIA !SEED'; ssl_stapling on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_certificate /etc/letsencrypt/live/sample_app/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/sample_app/privkey.pem; server_name sample_app; # need to listen to localhost for worker tier # server_name _ localhost; # need to listen to localhost for worker tier if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") { set $year $1; set $month $2; set $day $3; set $hour $4; } access_log /var/log/nginx/access.log main; access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd; location / { proxy_pass http://my_app; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location /assets { alias </path/to/app>/public/assets; gzip_static on; gzip on; expires max; add_header Cache-Control public; } location /public { alias </path/to/app>/public; gzip_static on; gzip on; expires max; add_header Cache-Control public; } }
config/puma.rb
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i threads threads_count, threads_count port ENV.fetch("PORT") { 3000 } environment ENV.fetch("RAILS_ENV") { "development" } plugin :tmp_restart bind "unix:///var/run/puma/my_app.sock"
ポート確認
httpsポートは空いていて、nginxで使用できているようにみえますが、違ってますでしょうか?
$ ss -tulp state listening
Netid Recv-Q Send-Q Local Address:Port Peer Address:Port tcp 0 100 127.0.0.1:smtp *:* users:(("master",pid=1067,fd=13)) tcp 0 128 *:https *:* users:(("nginx",pid=31011,fd=7),("nginx",pid=31010,fd=7)) tcp 0 128 *:http *:*

あなたの回答
tips
プレビュー