首页 > 解决方案 > 在docker中以supervisord作为CMD运行Lucee(tomcat),奇怪的路径问题

问题描述

我创建了一个 Dockerfile 来使用 Apache 运行我的 Lucee (Coldfusion on Tomcat) 服务。这一切都很好,但是,我有一个子站点,我在 apache webroot 中运行 index.cfm。奇怪的是,我收到一条找不到文件的错误消息:

Page /supervisord-c/index.cfm [/var/www/project/tracker/root/supervisord-c/index.cfm] not found

该文件实际上位于/var/www/project/tracker/root/index.cfm].

现在是 supervisord 我的 dockerfile 中的最后一个命令

...config stuff..
# Run config scripts
ADD scripts/setup.sh /root/setup.sh
RUN chmod +x /root/setup.sh
ENTRYPOINT ["/root/setup.sh"]

# Copy supervisord.conf
COPY scripts/supervisord.conf /etc/supervisor/conf.d/

# Expose HTTP and HTTPS ports
EXPOSE 80 443

# Engage
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]

supervisord 所做的是运行 Apache 和 Tomcat Catelina。

我摆脱了 supervisord 并运行了 CMD["/usr/sbin/apachectl","-DFOREGROUND"]并手动启动了 Catelina。工作的网站,但index.cfm现在的子网站显示以下错误:

Page /usr/sbin/index.cfm [/var/www/project/tracker/root/usr/sbin/index.cfm] not found

所以在我执行的最后一个 CMD 肯定有一个连接,以及它如何影响我的 tomcat webroot。

知道如何解决这个问题吗?

标签: dockerdocker-composetomcat7dockerfile

解决方案


找出问题所在。Lucee dockerfile 将代理传递添加到您的 apache.conf。这看起来像:

proxypass="\n\n<IfModule mod_proxy.c> \n
    ProxyPreserveHost On \n
    ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8888/$1$2 \n
    ProxyPassMatch ^/(.+\.cfchart)(/.*)?$ http://127.0.0.1:8888/$1$2 \n
    ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8888/$1$2 \n
    # optional mappings \n
    #ProxyPassMatch ^/flex2gateway/(.*)$ http://127.0.0.1:8888/flex2gateway/$1 \n
    #ProxyPassMatch ^/messagebroker/(.*)$ http://127.0.0.1:8888/messagebroker/$1 \n
    #ProxyPassMatch ^/flashservices/gateway(.*)$ http://127.0.0.1:8888/flashservices/gateway$1 \n
    #ProxyPassMatch ^/openamf/gateway/(.*)$ http://127.0.0.1:8888/openamf/gateway/$1 \n
    #ProxyPassMatch ^/rest/(.*)$ http://127.0.0.1:8888/rest/$1 \n
    ProxyPassReverse / http://127.0.0.1:8888/ \n
</IfModule> \n"

echo -e $proxypass >> /etc/apache2/apache2.conf

我从未注意到,当我查看我的 docker 容器apache2.conf文件时,我会看到

ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8888/supervisord-c

所以 $1 将我的supervisord-c映射添加到我的代理通行证。不知道为什么,但删除它解决了这个问题。


推荐阅读