Rails5.1.3でWebアプリケーション制作の勉強をしています。
production環境を設定していたらブラウザが開けなくなりサイトで調べてみたところSSH/HTTPSを有効にして接続する
ということでサイトの手順に従ってコマンドを打ち込んでいきました。
打ち込んだコマンドは以下になります。
$ openssl genrsa 2048 > server.key $ openssl req -new -key server.key > server.csr $ openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
次にconfig/puma.rbに以下を追記しました。
if "development" == ENV.fetch("RAILS_ENV") { "development" } ssl_bind '0.0.0.0', '9292', { key: "/file_path/server.key", cert: "/file_path/server.crt", verify_mode: "none" } end if "production" == ENV.fetch("RAILS_ENV") { "production" } ssl_bind '0.0.0.0', '443', { key: '/etc/letsencrypt/live/[example.com]/privkey.pem', cert: '/etc/letsencrypt/live/[example.com]/fullchain.pem', verify_mode: "none" } end
次にconfig/environments/production.rbに以下を追記しました。
config.force_ssl = true
そして「$ RAILS_ENV=production pumactl start」
「$ bundle exec pumactl start」の
どちらで起動しても以下のようなエラーが出てしまい解決出来ずにいます。
[vagrant@localhost chibi]$ bundle exec pumactl start Puma starting in single mode... * Version 3.10.0 (ruby 2.3.1-p112), codename: Russell's Teapot * Min threads: 5, max threads: 5 * Environment: development か production * Listening on tcp://0.0.0.0:3000 No such key file '/etc/letsencrypt/live/[example.com]/privkey.pem'
どなたか教えていただけないでしょうか?宜しくお願いします。
追記
$ openssl req -new -key server.key > server.csrのコマンドを打ち込んだ際に設定した内容を追記します。
$ openssl req -new -key server.key > server.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:JP State or Province Name (full name) []:Tokyo Locality Name (eg, city) [Default City]:Shinjyuku-ku Organization Name (eg, company) [Default Company Ltd]:IDCF Organizational Unit Name (eg, section) []:Dev Common Name (eg, your name or your server's hostname) []:ca-server Email Address []:example.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/02/22 01:24
2019/02/22 01:26
2019/02/22 03:19
2019/02/22 03:27