在 docker 容器中使用 apache 服务器配置 SSL
Configuring SSL with apache server in a docker container
我正在 ubuntu 中托管的 docker 容器中设置一个 LAMP 应用程序。我是docker菜鸟
我在托管 docker 容器的服务器上生成了 CSR,该容器具有我正在使用的 public IP 和域。
在我的 Docker 文件中
COPY ./dev.key /etc/apache2/ssl/dev.key
COPY ./dev.combined /etc/apache2/ssl/dev.combined
然后在 apache.conf 我有
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/dev.combined
SSLCertificateKeyFile /etc/apache2/ssl/dev.key
ServerAdmin admin@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
问题是当我尝试启动 apache 时出现错误:
AH02565: Certificate and private key 127.0.0.1:443:0
from /etc/apache2/ssl/dev.combined and /etc/apache2/ssl/dev.key do not
match AH00016: Configuration Failed
在配置此 docker 图像时我有些不明白。
Domain有一个真实的public IP,所以CSR和Cert需要指向这个IP。
我是否在 Docker 中设置不正确,所以它认为它是 运行 127.0.0.1 而不是我需要的 IP?
感谢您的帮助。我有点不知所措。
我找到了解决方案。
我很接近。我不得不做一些改变
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/dev.crt
SSLCertificateKeyFile /etc/apache2/ssl/dev.key
SSLCertificateChainFile /etc/apache2/ssl/dev.ca-bundle
但是修复 'Certificate and private' 错误的东西..
我必须在托管 docker
的服务器上的 /etc/host 中添加我的域
127.0.0.1 mydomain.dev localhost
我正在 ubuntu 中托管的 docker 容器中设置一个 LAMP 应用程序。我是docker菜鸟
我在托管 docker 容器的服务器上生成了 CSR,该容器具有我正在使用的 public IP 和域。
在我的 Docker 文件中
COPY ./dev.key /etc/apache2/ssl/dev.key
COPY ./dev.combined /etc/apache2/ssl/dev.combined
然后在 apache.conf 我有
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/dev.combined
SSLCertificateKeyFile /etc/apache2/ssl/dev.key
ServerAdmin admin@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
问题是当我尝试启动 apache 时出现错误:
AH02565: Certificate and private key 127.0.0.1:443:0 from /etc/apache2/ssl/dev.combined and /etc/apache2/ssl/dev.key do not match AH00016: Configuration Failed
在配置此 docker 图像时我有些不明白。
Domain有一个真实的public IP,所以CSR和Cert需要指向这个IP。
我是否在 Docker 中设置不正确,所以它认为它是 运行 127.0.0.1 而不是我需要的 IP?
感谢您的帮助。我有点不知所措。
我找到了解决方案。
我很接近。我不得不做一些改变
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/dev.crt
SSLCertificateKeyFile /etc/apache2/ssl/dev.key
SSLCertificateChainFile /etc/apache2/ssl/dev.ca-bundle
但是修复 'Certificate and private' 错误的东西.. 我必须在托管 docker
的服务器上的 /etc/host 中添加我的域127.0.0.1 mydomain.dev localhost