さくらVPSを使用しています。
centos7でdocker を動かしサイトを運用しています。
dockerではphp,web,mariadb,phpmyadminの4つのコンテナが動いています。
https化しようと思ってるのですがなかなか上手くいかず手詰まっています。
ご助力頂きたいです。
現状
普通のhttpでサイトは開ける状況です。
httpsで接続すると「接続が拒否されました。」と出ます。
やったこと
Let’s Encryptでssl証明ができるとあるので手順を調べやろうとしていました。
まずはcertbotを使うそうなので試してみました。
# certbot --apache -d [*********].vs.sakura.ne.jp
上記のコマンドを走らせたところ以下のように帰っってきました。
# certbot --apache -d [*********].vs.sakura.ne.jp Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org Requesting a certificate for [*********].vs.sakura.ne Performing the following challenges: http-01 challenge for [*********].vs.sakura.ne Error while running apachectl graceful. Job for httpd.service invalid. Unable to restart apache using ['apachectl', 'graceful'] Error while running apachectl restart. Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details. Cleaning up challenges Error while running apachectl graceful. Job for httpd.service invalid. Unable to restart apache using ['apachectl', 'graceful'] Error while running apachectl restart. Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details. Encountered exception during recovery: MisconfigurationError: Error while running apachectl restart. Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details. Error while running apachectl restart. Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
上記の通りに systemctl status httpd.serviceを入力してみたら以下のようになりました。
# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since 水 2022-06-08 16:35:13 JST; 1h 27min ago Docs: man:httpd(8) man:apachectl(8) Process: 985 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 985 (code=exited, status=1/FAILURE) 6月 08 16:35:13 [*********].vs.sakura.ne.jp systemd[1]: Starting The Apache HTTP Server... 6月 08 16:35:13 [*********].vs.sakura.ne.jp httpd[985]: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf/httpd.conf:355 6月 08 16:35:13 [*********].vs.sakura.ne.jp httpd[985]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 6月 08 16:35:13 [*********].vs.sakura.ne.jp httpd[985]: no listening sockets available, shutting down 6月 08 16:35:13 [*********].vs.sakura.ne.jp httpd[985]: AH00015: Unable to open logs 6月 08 16:35:13 [*********].vs.sakura.ne.jp systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE 6月 08 16:35:13 [*********].vs.sakura.ne.jp systemd[1]: Failed to start The Apache HTTP Server. 6月 08 16:35:13 [*********].vs.sakura.ne.jp systemd[1]: Unit httpd.service entered failed state. 6月 08 16:35:13 [*********].vs.sakura.ne.jp systemd[1]: httpd.service failed.
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
6月 08 16:35:13 [*********].vs.sakura.ne.jp httpd[985]: no liste
とあるのでなんとなく80番ポートが使用されているので使えないんだろうなと言うのはわかるのですが、
80番はdocker のwebコンテナで使用しています。
dockerのコンテナを落とすわけにもいかない気がするのですが、
この場合どうしたら良いのでしょう?
質問内容
上記のようにサーバー内でdocekrを動かしている場合どのようにhttps化すれば良いのでしょうか?
方針がわからず困っています。
ご助力のほどよろしくお願いします。
回答2件
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。