###前提・実現したいこと
実現したいことは、SSL通信でのRailsアプリケーションへの接続です。
SSL証明はLet’s Encryptを利用しています。
docker+apache2+rails+passengerを使って接続を試みてます。
HTTPでは繋がるのですが、HTTPSで上手くいきません。
###発生している問題・エラーメッセージ
Webページのエラー
We're sorry, but something went wrong. If you are the application owner check the logs for more information.
###試したこと
/etc/apache2/sites-available/default-ssl.conf
<VirtualHost *:443> SSLEngine on SSLCertificateFile /etc/letsencrypt/live/-----/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/-----/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/------/chain.pem <Directory "/var/www/html/------/------/public/"> AllowOverride All </Directory> ServerAdmin -----@----- DocumentRoot /var/www/html/-----/-------/public ServerName -----.--- </VirtualHost>
railsアプリケーション/config/secrets.yml
1,rake secretを実行
2,rake secretで出力されたシークレットキーをコピー
3,/yourapp/config/secrets.yml を開く
4,production secret_key_base に2でコピーしたシークレットキーを貼り付け
development: secret_key_base: キー test: secret_key_base: キー # Do not keep production secrets in the unencrypted secrets file. # Instead, either read values from the environment. # Or, use `bin/rails secrets:setup` to configure encrypted secrets # and move the `production:` environment over there. production: secret_key_base: 上記にあります、2のシークレットキーを直接はりつけました。
設定が完了した後に以下のコマンドを実行しています。
1, service apache2 reload 2, rails s
dockerの設定はこちらになります
0.0.0.0:443->443/tcp, 0.0.0.0:80->3000/tcp
/var/apache2/error.log こちらがログになります
App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] railties (5.1.4) lib/rails/rack/logger.rb:36:in `call_app' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] railties (5.1.4) lib/rails/rack/logger.rb:24:in `block in call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `block in tagged' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in `tagged' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in `tagged' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] railties (5.1.4) lib/rails/rack/logger.rb:24:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] rack (2.0.3) lib/rack/method_override.rb:22:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] rack (2.0.3) lib/rack/runtime.rb:22:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] rack (2.0.3) lib/rack/sendfile.rb:111:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] actionpack (5.1.4) lib/action_dispatch/middleware/ssl.rb:66:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] railties (5.1.4) lib/rails/engine.rb:522:in `call' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] passenger (5.1.12) src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] passenger (5.1.12) src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] passenger (5.1.12) src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] passenger (5.1.12) src/ruby_supportlib/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads' App 491 stderr: [833aeb01-01fb-48b0-8834-4762b6a01bc1] passenger (5.1.12) src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception' App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] Started GET "/" for 114.179.36.199 at 2017-12-15 02:54:40 +0000 App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] Processing by SitesController#top as HTML App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] Rendering sites/top.html.erb within layouts/capplication App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] Rendered shared/_top_head_new.html.erb (0.8ms) App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] Rendered sites/top.html.erb within layouts/capplication (1.0ms) App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] Completed 500 Internal Server Error in 2ms App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] ActionView::Template::Error (unable to open database file): App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] 1: <% @user = User.new %> App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] 2: <%= form_for(@user, url: signup_path, class: 'modal-body') do |f| %> App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] 3: <%= render 'shared/error_messages', object: f.object %> App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] 4: App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] app/views/shared/_top_head_new.html.erb:1:in `_app_views_shared__top_head_new_html_erb___2585659761307323350_47295158984640' App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] app/views/sites/top.html.erb:53:in `_app_views_sites_top_html_erb___3818639998974615192_47295156103840' App 491 stderr: [6f862958-89dc-4626-b05b-53ddd5c31921] app/controllers/sites_controller.rb:17:in `top'
###補足
初めての質問です、見づらくて申し訳ありません。中身がいまいちつかめていないので動きも含めて教えていただけるととても嬉しいです。
あなたの回答
tips
プレビュー