apache MediaWiki样式表未加载(load.php显示主页)

s5a0g9ez  于 2023-10-23  发布在  Apache
关注(0)|答案(1)|浏览(157)

安装mediawiki后,样式表无法正确加载。以下是最低复制指令:
使用以下git repo:从分支step1开始的https://sourceforge.net/p/mediawiki-problem/code/ci/step1/tree/

  1. ./startup启动wiki、数据库和反向代理
  2. docker container exec -ti swarm_lithia-wiki<tab> bash在mediawiki容器中运行bash
    1.在容器内部,mkdir lithia && mv * lithia;将所有内容移动到lithia目录,以便可以正确地提供所有内容
    1.在Web浏览器中访问http://localhost:80/lithia,我看到安装提示
    在安装过程中,我设置了以下设置:
  • 数据库主机lithia-db(匹配docker compose文件中的服务名称)
  • 数据库名称lithia
  • 数据库表前缀li_
  • 数据库用户名root
  • 数据库密码moresecurepassword
  • 取消选中“使用与安装相同的帐户”
  • 数据库用户名lithiauser
  • 数据库密码somesecurepassword
  • 选择“创建帐户...”
  • 继续
  • 维基名称Lithia
  • 用户名:lmat
  • 密码:goodpassword
  • 选择“我很无聊......”,然后继续,然后继续

一切看起来都很好。
LocalSettings.php保存到/lithia-wiki的git仓库中。

  • 在repo中查看step2,将LocalSettings.php卷添加到swarm.yml
  • 再次运行./startup以重新启动服务,这将撤消上面的mv并挂载LocalSettings.php文件。

现在看,页面加载没有CSS

调查问题,我在浏览器控制台中看到以下内容:

  1. Refused to apply style from
  2. 'http://localhost/lithia/load.php?lang=en&modules=skins.vector.styles.legacy&only=styles&skin=vector'
  3. because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict
  4. MIME checking is enabled.

访问该页面,http://localhost/lithia/load.php?lang=en&modules=skins.vector.styles.legacy&only=styles&skin=vector,正在加载主页。
我该怎么解决这个问题?我在安装过程中做错了什么?

dphi5xsq

dphi5xsq1#

because its MIME type ('text/html') is not a supported stylesheet MIME type
这通常发生在MediaWiki找不到指定资源时,通常是由于错误配置或路径问题。
您需要按照Manual:load.phpthis thread中的建议调试load.php
在您的MediaWiki容器中,导航到maintenance文件夹并执行eval.php以检查您的MediaWiki环境是否正常运行。

  1. cd /path/to/mediawiki/maintenance
  2. php eval.php

输入一些简单的MediaWiki PHP命令以查看它们是否成功执行。
请参阅“Wiki出现时未应用样式且缺少图像”:
MediaWiki的ResourceLoader负责提供CSS和JS。确保URL配置正确。检查LocalSettings.php以确保$wgScriptPath$wgResourceBasePath和其他URL设置正确。
并确保在Web服务器中正确配置了URL重写。如果设置不正确,可能会导致意外行为。验证Web服务器是否正确地将请求转发到MediaWiki。
从Docker开始,检查您的Dockerfile和docker-compose文件是否存在可能导致此问题的任何问题。由于主机目录装载而导致的文件权限问题可能是一个问题。

相关问题