带有 docker 的 Mediawiki找不到LocalSettings.php,无法访问数据库

如何解决带有 docker 的 Mediawiki找不到LocalSettings.php,无法访问数据库

我已经在我的 Raspberry Pi3 上使用 docker 设置了一个带有 mariadb 的 mediawiki(版本 1.35.1)。 当我第一次运行 docker-compose 文件时一切正常,我可以创建 LocalSettings.php。

问题 1:
我将 LocalSettings.php 复制到路径 /data/conf/LocalSettings.php,取消注释 docker-compose.yml 文件中的行并使用 docker-compose restart 重新启动。但我总是回到“请完成安装”页面。当我将文件复制到路径 /var/www/html
上的 mediawiki 容器时,它才起作用 为什么mediawiki 找不到LocalSettings.php?还是我理解错了?

这是我的 docker-compose.yml 文件

version: '3.3'
services:
  mediawiki:
    image: mediawiki
    restart: always
    ports:
      - ${BIND_TO}:${INT_PORT}
    links:
      - database
    volumes:
      - data_mw_images:/var/www/html/images
      - ./data/sitemap:/var/www/html/sitemap
      # After initial setup,download LocalSettings.php to data/conf directory
      # and uncomment the following line and use compose to restart
      # the mediawiki service
      #- ./data/conf/LocalSettings.php:/var/www/html/LocalSettings.php:ro
      # - ./data/conf/.htaccess:/var/www/html/.htaccess:ro
      # Spezial Stuff (Google AdSense & Search Console)
      #- ./data/conf/robots.txt:/var/www/html/robots.txt:ro
      #- ./data/conf/ads.txt:/var/www/html/ads.txt:ro
      # Mediwaiki Extensions
      #- ./data/extensions/WikiCategoryTagCloud:/var/www/html/extensions/WikiCategoryTagCloud:ro
      #- ./data/extensions/CategoryTagCloud:/var/www/html/extensions/CategoryTagCloud:ro
      #- ./data/extensions/SelectCategory:/var/www/html/extensions/SelectCategory:ro
      #- ./data/extensions/googleAnalytics:/var/www/html/extensions/googleAnalytics:ro
      #- ./data/extensions/GoogleAdSense:/var/www/html/extensions/GoogleAdSense:ro
      #- ./data/extensions/Lockdown:/var/www/html/extensions/Lockdown:ro
      #- ./data/extensions/MobileFrontend:/var/www/html/extensions/MobileFrontend:ro
      #- ./data/extensions/CookieWarning:/var/www/html/extensions/CookieWarning:ro
      #- ./data/extensions/RelatedArticles:/var/www/html/extensions/RelatedArticles:ro
      #- ./data/extensions/Description2:/var/www/html/extensions/Description2:ro
      # Mediawiki Skins
      #- ./data/skins/MinervaNeue:/var/www/html/skins/MinervaNeue:ro

  database:
    image: linuxserver/mariadb:arm32v6-latest
    volumes:
      - data_mw_db:/var/lib/mysql
    restart: always
    environment:
      # @see https://phabricator.wikimedia.org/source/mediawiki/browse/master/includes/DefaultSettings.php
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
      MYSQL_RANDOM_ROOT_PASSWORD: ${MYSQL_RANDOM_ROOT_PASSWORD}
      TZ: ${TZ}
volumes:
  data_mw_db:
  data_mw_images:

问题 2:
当我将 LocalSettings.php 复制到容器中时,它工作正常。 但是当我重新启动我的 Pi 并尝试访问 Mediawiki 页面时,我又收到了另一个错误(但错误不是每次我重新启动时都会出现。有时它会起作用......?‍♂️)

Sorry! This site is experiencing technical difficulties.

Try waiting a few minutes and reloading.

(Cannot access the database)

Backtrace:

#0 /var/www/html/includes/libs/rdbms/loadbalancer/LoadBalancer.php(934): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /var/www/html/includes/libs/rdbms/loadbalancer/LoadBalancer.php(901): Wikimedia\Rdbms\LoadBalancer->getServerConnection(0,'mywikidb',0)
#2 /var/www/html/includes/libs/rdbms/loadbalancer/LoadBalancer.php(1046): Wikimedia\Rdbms\LoadBalancer->getConnection(-1,Array,0)
#3 /var/www/html/includes/GlobalFunctions.php(2469): Wikimedia\Rdbms\LoadBalancer->getMaintenanceConnectionRef(-1,'mywikidb')
#4 /var/www/html/includes/cache/localisation/LCStoreDB.php(56): wfGetDB(-1)
#5 /var/www/html/includes/cache/localisation/LocalisationCache.php(449): LCStoreDB->get('en','deps')
#6 /var/www/html/includes/cache/localisation/LocalisationCache.php(495): LocalisationCache->isExpired('en')
#7 /var/www/html/includes/cache/localisation/LocalisationCache.php(414): LocalisationCache->initLanguage('en')
#8 /var/www/html/includes/cache/localisation/LocalisationCache.php(333): LocalisationCache->loadSubitem('en','messages','title-invalid-e...')
#9 /var/www/html/languages/Language.php(2645): LocalisationCache->getSubitem('en','title-invalid-e...')
#10 /var/www/html/includes/cache/MessageCache.php(1030): Language->getMessage('title-invalid-e...')
#11 /var/www/html/includes/cache/MessageCache.php(988): MessageCache->getMessageForLang(Object(LanguageEn),'title-invalid-e...',false,Array)
#12 /var/www/html/includes/cache/MessageCache.php(930): MessageCache->getMessageFromFallbackChain(Object(LanguageEn),false)
#13 /var/www/html/includes/language/Message.php(1304): MessageCache->get('title-invalid-e...',Object(LanguageEn))
#14 /var/www/html/includes/language/Message.php(862): Message->fetchMessage()
#15 /var/www/html/includes/language/Message.php(954): Message->toString('text')
#16 /var/www/html/includes/title/MalformedTitleException.php(51): Message->text()
#17 /var/www/html/includes/title/MediaWikiTitleCodec.php(346): MalformedTitleException->__construct('title-invalid-e...','')
#18 /var/www/html/includes/Title.php(3413): MediaWikiTitleCodec->splitTitleString('',0)
#19 /var/www/html/includes/Title.php(427): Title->secureAndSplit('')
#20 /var/www/html/includes/MediaWiki.php(88): Title::newFromURL(NULL)
#21 /var/www/html/includes/MediaWiki.php(151): MediaWiki->parseTitle()
#22 /var/www/html/includes/MediaWiki.php(902): MediaWiki->getTitle()
#23 /var/www/html/includes/MediaWiki.php(543): MediaWiki->main()
#24 /var/www/html/index.php(53): MediaWiki->run()
#25 /var/www/html/index.php(46): wfIndexMain()
#26 {main}

有人知道怎么解决吗?

这是 LocalSettings.php:

<?php
# This file was automatically generated by the MediaWiki 1.35.1
# installer. If you make manual changes,please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values,but don't forget to make changes in _this_
# file,not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
        exit;
}


## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;

$wgSitename = "Wiki Home";
$wgMetaNamespace = "Wiki_Home";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";

## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://192.168.178.22:9002";

## The URL path to static resources (images,scripts,etc.)
$wgResourceBasePath = $wgScriptPath;

## The URL paths to the logo.  Make sure you change this from the default,## or else you'll overwrite your logo when you upgrade!
$wgLogos = [ '1x' => "$wgResourceBasePath/resources/assets/wiki.png" ];

## UPO means: this is also a user preference option

$wgEnableEmail = true;
$wgEnableUserEmail = true; # UPO

$wgEmergencyContact = "apache@?.invalid";
$wgPasswordSender = "apache@?.invalid";

$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype = "mysql";
$wgDBserver = "database";
$wgDBname = "wikidb";
$wgDBuser = "mediawikiuser";
$wgDBpassword = "xxx";

# MySQL specific settings
$wgDBprefix = "";

# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB,DEFAULT CHARSET=binary";

# Shared database table
# This has no effect unless $wgSharedDB is also set.
$wgSharedTables[] = "actor";

## Shared memory settings
$wgMainCacheType = CACHE_ACCEL;
$wgMemCachedServers = [];

## To enable image uploads,make sure the 'images' directory
## is writable,then set this to true:
$wgEnableUploads = false;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

# InstantCommons allows wiki to use images from https://commons.wikimedia.org
$wgUseInstantCommons = false;

# Periodically send a pingback to https://www.mediawiki.org/ with basic data
# about this MediaWiki instance. The Wikimedia Foundation shares this data
# with MediaWiki developers to help guide future development efforts.
$wgPingback = true;

## If you use ImageMagick (or any other shell command) on a
## Linux server,this will need to be set to the name of an
## available UTF-8 locale. This should ideally be set to an English
## language locale so that the behaviour of C library functions will
## be consistent with typical installations. Use $wgLanguageCode to
## localise the wiki.
$wgShellLocale = "C.UTF-8";

## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publicly accessible from the web.
#$wgCacheDirectory = "$IP/cache";

# Site language code,should be one of the list in ./languages/data/Names.php
$wgLanguageCode = "en";

$wgSecretKey = "xxx";

# Changing this will log out all existing sessions.
$wgAuthenticationTokenVersion = "1";

# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "cbbac7c99e42cd92";

## For attaching licensing metadata to pages,and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";

## Default skin: you can change the default skin. Use the internal symbolic
## names,ie 'vector','monobook':
$wgDefaultSkin = "vector";

# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );


# End of automatically generated settings.
# Add more configuration options below.

$wgSessionCacheType = CACHE_DB;

希望有人能帮助我。

感谢和问候

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-