前提・実現したいこと
現在 RaspberryPi3(B)(Raspbian)環境にて Wordpress(最新バージョン)を導入しており,
Wordpressでブログの公開を検討しています.
現在,サイトのhttps化(Let’s Encrypt の導入)について質問があります
なお, https://enoatu.com/?p=1612 こちらのサイトを参照しながら作業して
問題が発生しました
発生している問題・エラーメッセージ
https://enoatu.com/?p=1612
のapache設定まで行ったのですが
$ a2ensite default-ssl
$ a2enmod ssl
$ systemctl restart apache2.service
の最後でエラーコードが生じ,Apache2が再起動できず,起動することができなくなってしまいました.
エラーメッセージ Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
メッセージのとおり
"systemctl status apache2.service" と "journalctl -xe" をそれぞれ参照したところ
ログ "systemctl status apache2.service" apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2018-08-14 17:09:02 JST; 2min 4s ago Process: 2024 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE) 8月 14 17:09:02 raspi systemd[1]: Starting The Apache HTTP Server... 8月 14 17:09:02 raspi apachectl[2024]: AH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/default-ssl.conf: 8月 14 17:09:02 raspi apachectl[2024]: SSLCertificateFile: file '/etc/letsencrypt/live/(私の入力したdomain)/cert.pem' does not exist or 8月 14 17:09:02 raspi apachectl[2024]: Action 'start' failed. 8月 14 17:09:02 raspi apachectl[2024]: The Apache error log may have more information. 8月 14 17:09:02 raspi systemd[1]: apache2.service: Control process exited, code=exited status=1 8月 14 17:09:02 raspi systemd[1]: Failed to start The Apache HTTP Server. 8月 14 17:09:02 raspi systemd[1]: apache2.service: Unit entered failed state. 8月 14 17:09:02 raspi systemd[1]: apache2.service: Failed with result 'exit-code'.
ログ"journalctl -xe" 8月 14 17:10:01 raspi CRON[2078]: (root) CMD (sudo /home/pi/noticeIP.sh) 8月 14 17:10:01 raspi sudo[2079]: root : TTY=unknown ; PWD=/root ; USER=root ; COMMAND=/home/pi/noticeIP.sh 8月 14 17:10:01 raspi sudo[2079]: pam_unix(sudo:session): session opened for user root by (uid=0) 8月 14 17:10:02 raspi sudo[2079]: pam_unix(sudo:session): session closed for user root 8月 14 17:10:02 raspi CRON[2074]: (CRON) info (No MTA installed, discarding output) 8月 14 17:10:02 raspi CRON[2074]: pam_unix(cron:session): session closed for user root 8月 14 17:10:18 raspi dhclient[912]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 5 8月 14 17:10:23 raspi dhclient[912]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 8 8月 14 17:10:31 raspi dhclient[912]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 8 8月 14 17:10:39 raspi dhclient[912]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 15 8月 14 17:10:54 raspi dhclient[912]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 20 8月 14 17:11:14 raspi dhclient[912]: DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 5 8月 14 17:11:19 raspi dhclient[912]: No DHCPOFFERS received. 8月 14 17:11:19 raspi dhclient[912]: No working leases in persistent database - sleeping. 8月 14 17:11:35 raspi systemd[1]: Starting Cleanup of Temporary Directories... -- Subject: Unit systemd-tmpfiles-clean.service has begun start-up -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- Unit systemd-tmpfiles-clean.service has begun starting up. 8月 14 17:11:35 raspi systemd[1]: Started Cleanup of Temporary Directories. -- Subject: Unit systemd-tmpfiles-clean.service has finished start-up -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- Unit systemd-tmpfiles-clean.service has finished starting up. -- -- The start-up result is done.
の様です.
前者は素人の私からは
「'/etc/letsencrypt/live/(私の入力したdomain)/cert.pem' does not exist or 」
等からフォルダを確認してみたところそもそもliveフォルダが作成されていないなどが読み取れました.何故作成されてないのか...
(他のログからは何も,さっぱりわからないです...)
後者もやはり具体的に何がいけないかはわからないです...
試したこと
https://enoatu.com/?p=1612 の途中手順にあるapache設定中の
/etc/apache2/sites-available/default-ssl.conf 初期では↓と書かれているところがあるので SSLCertificateFile SSLCertificateKeyFile コメントアウトし、下記を追加。 SSLCertificateFile /etc/letsencrypt/live/[サーバーのドメイン]/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/[サーバーのドメイン]/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/[サーバーのドメイン]/chain.pem
これについて
コメントアウト状況を元に戻してapache2の再起動を図ったが,
再起動はできなかった.(全く同じエラーメッセージ)
この時のログ "systemctl status apache2.service"は以下の通り
ログ "systemctl status apache2.service" Failed to get properties: Unit name apache2.service].service is not valid. root@raspi:/home/pi# systemctl status apache2.service ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2018-08-14 17:20:51 JST; 32s ago Process: 2157 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE) 8月 14 17:20:51 raspi apachectl[2157]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:443 8月 14 17:20:51 raspi apachectl[2157]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443 8月 14 17:20:51 raspi apachectl[2157]: no listening sockets available, shutting down 8月 14 17:20:51 raspi apachectl[2157]: AH00015: Unable to open logs 8月 14 17:20:51 raspi apachectl[2157]: Action 'start' failed. 8月 14 17:20:51 raspi apachectl[2157]: The Apache error log may have more information. 8月 14 17:20:51 raspi systemd[1]: apache2.service: Control process exited, code=exited status=1 8月 14 17:20:51 raspi systemd[1]: Failed to start The Apache HTTP Server. 8月 14 17:20:51 raspi systemd[1]: apache2.service: Unit entered failed state. 8月 14 17:20:51 raspi systemd[1]: apache2.service: Failed with result 'exit-code'.
他,Raspberrypi本体の再起動を行ったが起動できず.
知恵を貸していただけないでしょうか...
よろしくお願いします.
2018/08/15 追記1:
先ほど追記点としてCertbotのエラーログについて再度実行して取得するという形でログを掲載しましたが,
・昨日実行時は確認メールアドレスまで聞かれたので明らかに今日のとログ内容が違う
・そもそも再度実行して得られたログに意味があるか?
という理由から削除しました.
SSLなど詳しくなく,前回のCertbotのログも流れてしまっているので
一旦CertBotを削除して,apache2の設定ファイルも手動で書き直し,
まずはApache2自体が以前と同じように動くようにしたほうがいいんでしょうか...
2018/08/15 追記2:
Certbotを消しただけではやはりapache2は再起動できず.(どこか.confファイルを手動で書き直す必要か)
念のため:Certbot削除⇒Certbot導入時に出たログの確認
メールアドレスが聞かれただけで再導入時と導入時で特にログに違いはなさそう
また,ドメイン,ドキュメントルートの記法が違うかもと思い一応情報を記す
WordPressのルートがvar/wwwだから大丈夫だと思っているけど心配なので
以下それぞれ
mydns.jpで登録してる様子,apache2.confのドキュメントルートの記述箇所,
Certbot再導入時のログ
# Sets the default security model of the Apache2 HTTPD server. It does # not allow access to the root filesystem outside of /usr/share and /var/www. # The former is used by web applications packaged in Debian, # the latter may be used for local directories served by the web server. If # your system is serving content from a sub-directory in /srv you must allow # access here, or in any related virtual host. <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /usr/share> AllowOverride None Require all granted </Directory> <Directory /var/www/> (ココ) Options Indexes FollowSymLinks AllowOverride None Require all granted #AddHandler .php </Directory> #<Directory /srv/> # Options Indexes FollowSymLinks # AllowOverride None # Require all granted #</Directory>
root@raspi:/home/pi# certbot certonly --webroot -w /var/www/ -d raspberrypi422.mydns.jp Saving debug log to /var/log/letsencrypt/letsencrypt.log Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel):kang.dream.123456789@gmail.com ------------------------------------------------------------------------------- Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v01.api.letsencrypt.org/directory ------------------------------------------------------------------------------- (A)gree/(C)ancel: a Obtaining a new certificate Performing the following challenges: http-01 challenge for raspberrypi422.mydns.jp Using the webroot path /var/www for all unmatched domains. Waiting for verification... Cleaning up challenges Failed authorization procedure. raspberrypi422.mydns.jp (http-01): urn:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://raspberrypi422.mydns.jp/.well-known/acme-challenge/UFuQsEmfmFEnHAMm8jQS5sMF7ZjEH9Y-qXDZJJ3HH24: Connection refused IMPORTANT NOTES: - If you lose your account credentials, you can recover through e-mails sent to ??????????(適当なメールアドレス) The following errors were reported by the server: Domain: raspberrypi422.mydns.jp Type: connection Detail: Fetching http://raspberrypi422.mydns.jp/.well-known/acme-challenge/UFuQsEmfmFEnHAMm8jQS5sMF7ZjEH9Y-qXDZJJ3HH24: Connection refused To fix these errors, please make sure that your domain name was entered correctly and the DNS A record(s) for that domain contain(s) the right IP address. Additionally, please check that your computer has a publicly routable IP address and that no firewalls are preventing the server from communicating with the client. If you're using the webroot plugin, you should also verify that you are serving files from the webroot path you provided.
何度も何度も編集して申し訳ない...;;
補足情報(FW/ツールのバージョンなど)
・debian ver 9.4
・Apache Server version: Apache/2.4.25 (Raspbian)
回答3件
あなたの回答
tips
プレビュー