求助:能否将Tomcat8下DokuWiki的data目录移至外部路径?
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:
Locate DokuWiki's configuration file
Navigate to your DokuWiki installation'sconffolder (it should be at../tomcat_dir/mydokuwiki/dokuwiki/conf). If you don't see alocal.phpfile, make a copy oflocal.php.distand rename it tolocal.php—this will be your editable configuration file.Update the
savedirsetting
Openlocal.phpin 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.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 originaldatadirectory (../tomcat_dir/mydokuwiki/dokuwiki/data) tod:/test/prueba.Set proper permissions
Make sure the user running Tomcat (usuallyLocal Systemor a dedicated service account on Windows) has read, write, and modify permissions on thed:/test/pruebadirectory. Without this, DokuWiki won't be able to save edits, upload files, or update its data.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 newd:/test/pruebadirectory (check for new files in its subfolders likepagesormedia).
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

