【发布时间】:2018-02-19 10:21:31
【问题描述】:
我正在将最初安装在一台服务器(比如SERVER_1)下的 joomla 网站作为 Apache 2 下的 Web 应用程序移动到另一台服务器(SERVER_2)。
在第二台服务器中,joomla 站点安装为 docker 容器(实际上是两个 docker 容器,第二个运行 mysql 实例)。 joomla contiainer 公开端口8081,如果我通过浏览器访问http://<SERVER_2_IP>:8081/,该站点将完美运行。
现在我尝试将名称www.example.com 的提供商的DNS 设置从旧服务器的IP 更改为新服务器的IP。此外,在SERVER_2我有一个apache2,我用它来充当代理,将www.example.com的请求转发到正确的端口8081。以下是apache2的虚拟主机定义文件(我不是apache2配置专家,只是将其从配置映射复制到其他容器化应用程序,非 joomla 应用程序,它们工作正常)。
<VirtualHost *:80>
ServerName www.example.com
<LocationMatch "^/">
AllowOverride None
Require all granted
</LocationMatch>
ErrorLog /path/to/folder/under/home/example.error.log
LogLevel trace1
CustomLog /path/to/folder/under/home/example.access.log combined
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
</VirtualHost>
问题是,当从浏览器http://www.example.com 访问该站点时,尽管找到了该站点,但样式似乎已损坏。如果我检查浏览器控制台,我会看到如下错误列表(注意:我从意大利语翻译了消息,因此实际的错误消息可能不同)。
Loading failed for the <script> with source “http://localhost:8081/media/jui/js/jquery.min.js”.
Loading failed for the <script> with source “http://localhost:8081/media/jui/js/jquery-noconflict.js”.
Loading failed for the <script> with source “http://localhost:8081/media/jui/js/jquery-migrate.min.js”.
Loading failed for the <script> with source “http://localhost:8081/media/system/js/caption.js”.
Loading failed for the <script> with source “http://localhost:8081/media/system/js/mootools-core.js”.
Loading failed for the <script> with source “http://localhost:8081/media/system/js/core.js”.
Loading failed for the <script> with source “http://localhost:8081/media/system/js/mootools-more.js”.
Loading failed for the <script> with source “http://localhost:8081/media/jui/js/bootstrap.min.js”.
Loading failed for the <script> with source “http://localhost:8081/templates/whalesafe/javascript/md_stylechanger.js”.
Loading failed for the <script> with source “http://localhost:8081/templates/whalesafe/javascript/hide.js”.
Loading failed for the <script> with source “http://localhost:8081/templates/whalesafe/javascript/respond.src.js”.
Loading failed for the <script> with source “http://localhost:8081/media/sourcecoast/js/jq-bootstrap-1.8.3.js”.
问题似乎与 joomla 代码试图从 localhost 而不是 www.example.com 访问 javascript 文件有关,但我不知道如何解决这个问题。
正如我所写,如果我使用IP/PORT 访问浏览器(我的本地计算机与服务器在同一网络下,所以我可以直接从这里访问端口 8081)一切正常,访问时也正常旧服务器上的站点。
编辑:只是为了添加更多细节,不仅在我加载主页时样式被破坏,而且菜单链接现在指向http://localhost:8081/index.php/en/...page url...
【问题讨论】: