OVH共享服务器子域名DokuWiki图片上传403错误求助
Hey there, let’s tackle this 403 upload issue with your DokuWiki on OVH’s shared server—total bummer when you’ve followed all the official steps and still hit a wall! Here are some targeted troubleshooting angles and fixes you might not have tried yet:
1. Dig into OVH’s Shared Server-Specific Restrictions
OVH shared hosts have default guardrails that can block uploads even if your PHP config looks correct:
- File size limits: Even with
file_uploads=on, check ifupload_max_filesizeandpost_max_sizeare set too low (OVH often defaults to 2MB). Add these lines to your.ovhconfigif missing:upload_max_filesize = 16M post_max_size = 20M - ModSecurity interference: OVH enables ModSecurity by default, which might flag your image uploads as suspicious. Test disabling it temporarily by adding this to your DokuWiki root’s
.htaccess:
Note: Only keep this disabled if it fixes the issue—then work with OVH to tweak specific rules instead of leaving it off entirely for security.<IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
2. Fix Directory Permissions (Beyond 777)
While 777 works for testing, OVH’s shared environment often blocks overly permissive permissions for security. Instead:
- Confirm the
data/mediadirectory (and all subfolders) is owned by your FTP user (notrootorwww-data)—use your FTP client to check ownership details. - Set directory permissions to
755and file permissions to644—this is the secure, OVH-compatible setup that should still allow uploads.
3. Double-Check DokuWiki’s Core Configs
Head to your conf/local.php file and verify these settings:
- Ensure
$conf['mediadir']points exactly to yourdata/mediafolder (no typos or incorrect paths). - Confirm
$conf['allow_upload']is set to1(it should be enabled by default, but it’s worth checking). - Match
$conf['uploadsize']to your PHPupload_max_filesize(e.g.,16M)—DokuWiki has its own upload limit that might override PHP’s.
4. Test with a Clean .htaccess
Custom .htaccess rules (either in DokuWiki’s root or your parent domain) can break uploads. Try renaming your current .htaccess to .htaccess.bak and test uploading again. If it works, go through the rules one by one to find the conflicting line.
5. Check OVH’s Firewall and Upload Blocklists
Log into your OVH Manager and look for these settings:
- Web Firewall: See if any rules are explicitly blocking image uploads.
- File Upload Filters: Some plans block specific extensions by default (even common ones like
.pngin rare cases)—make sure your image types are allowed.
6. Enable PHP Error Logging for Clues
A 403 error can sometimes hide a more specific issue. Enable logging in .ovhconfig to get detailed error messages:
log_errors = On error_log = /path/to/your/dokuwiki/error.log
Make sure the path is writable by your server user, then try uploading again. The log might reveal exactly what’s blocking the upload—like a hidden permission issue or ModSecurity trigger.
If none of these steps resolve the problem, reach out to OVH support directly. They can access server-side logs you don’t have access to, which could uncover things like quota limits or server-specific restrictions you can’t fix on your own.
内容的提问来源于stack exchange,提问作者Mehdi Ayad

