You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:能否将Tomcat8下DokuWiki的data目录移至外部路径?

DokuWiki Data Directory Migration on Tomcat

Hey there! Let's work through this DokuWiki data directory migration issue together—since you're running it on Tomcat, there's a much more straightforward way than messing with server.xml (your initial approach isn't the right fit here, and I'll explain why).

The Correct Approach: Modify DokuWiki's Configuration

DokuWiki has a built-in setting to define where its data is stored, so you don't need to adjust Tomcat's context mappings. Here's how to do it:

  1. Locate DokuWiki's configuration file
    Navigate to your DokuWiki installation's conf folder (it should be at ../tomcat_dir/mydokuwiki/dokuwiki/conf). If you don't see a local.php file, make a copy of local.php.dist and rename it to local.php—this will be your editable configuration file.

  2. Update the savedir setting
    Open local.php in a text editor, add or modify the following line to point to your new data directory:

    $conf['savedir'] = 'd:/test/prueba';
    

    Note: On Windows, you can also use double backslashes (like 'd:\\test\\prueba') if you prefer—both formats work in PHP.

  3. Copy existing data to the new directory
    Stop your Tomcat server first (to prevent active writes during migration), then copy all files and folders from your original data directory (../tomcat_dir/mydokuwiki/dokuwiki/data) to d:/test/prueba.

  4. Set proper permissions
    Make sure the user running Tomcat (usually Local System or a dedicated service account on Windows) has read, write, and modify permissions on the d:/test/prueba directory. Without this, DokuWiki won't be able to save edits, upload files, or update its data.

  5. Test the setup
    Start Tomcat back up, open your DokuWiki site, and try editing a page or uploading a file. Verify that the changes are saved to the new d:/test/prueba directory (check for new files in its subfolders like pages or media).

Why Your Original server.xml Method Isn't Right

Adding a Context entry in server.xml maps a directory to a web-accessible URL path (like yourdomain.com/new_data), but DokuWiki's data directory isn't meant to be a standalone web app—it's a backend storage location that DokuWiki needs to read/write directly. Tomcat's context mapping doesn't help DokuWiki find this directory; you have to tell DokuWiki explicitly where it lives via its own configuration.

内容的提问来源于stack exchange,提问作者Pablo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:56:11