【发布时间】:2020-06-17 10:29:16
【问题描述】:
我正在使用docker stack deploy 部署堆栈。在这个堆栈中有 nginx 作为反向代理和 apache2 作为后端服务器。
现在,如果我使用 curl -v http://service_name:8888 从其他容器访问我的 apache2 容器,它会返回 400 bad request 错误。但是,如果我尝试 curl -v 10.0.9.7:8888 它可以使用 200 个成功代码。
我无法确定错误在哪里。
000-default.conf
<VirtualHost *:*>
ServerAdmin admin@sa.com
DocumentRoot "/var/www/site"
ServerName r.sa.com
<Directory /var/www/site>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
ports.conf
Listen 8888
Listen 8889
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
error.log
/var/log/apache2/error.log
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.0.9. Set the 'ServerName' directive globally to suppress this message
[Thu Mar 05 07:17:41.921722 2020] [mpm_prefork:notice] [pid 8] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Thu Mar 05 07:17:41.922504 2020] [core:notice] [pid 8] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
【问题讨论】:
-
"400 bad request error" 似乎service_name:8888 被某些使用 SSL 的服务处理并在请求中接收纯文本。你能添加一些日志吗?。
-
@matiferrigno 添加了 apache 的 error.log
-
能否在两者都进行 curl 的时间间隔内添加 apache 和 nginx 反向代理日志的访问/错误日志?
-
你也可以添加到 stack.yml 吗?
标签: docker docker-swarm apache2.4