Are you running WordPress in a Docker container and suddenly can’t upgrade your database or WordPress core? Do you see
403 Forbidden errors when accessing /wp-admin/upgrade.php? You’re not alone!
This issue is common, especially for WordPress sites that use additional security measures or custom .htaccess rules inside Docker environments.
Below, I’ll show you how to identify the root cause and fix this WordPress/Docker 403 Forbidden error in just a few minutes.
Table of Contents
Symptoms: 403 Forbidden When Upgrading WordPress
When you try to update your WordPress core or trigger a database update, you might see an error like:
403 ForbiddenYou don't have permission to access /wp-admin/upgrade.php on this server.Or you may find the following entry in your server logs:
[access_compat:error] [client x.x.x.x] AH01797: client denied by server configuration: /var/www/html/wp-admin/upgrade.phpWhy Does This Happen in Docker?
Many “hardened” WordPress installations follow security guides that restrict access to sensitive scripts like upgrade.php or install.php using .htaccess rules.
These rules are often found in /var/www/html/wp-admin/.htaccess inside your Docker container or server:
<Files upgrade.php> Order Allow,Deny Deny from all</Files>This configuration blocks all access to upgrade.php – even for legitimate admin actions. While this may make sense on a public-facing server, it will also block you, the site admin, from performing necessary upgrades. This is especially problematic inside Docker containers, where requests often originate from internal network IPs.
Solution: Remove or Comment Out the .htaccess Block
The fix is simple: remove or comment out the .htaccess block that denies access to upgrade.php.
Step-by-Step Guide to Fixing 403 Forbidden on upgrade.php
- Access your Docker container shell.
For Docker, run:docker exec -it <container-name> bashor
docker exec -it <container-id> bash - Edit the
/var/www/html/wp-admin/.htaccessfile.
Open it with your CLI editor:nano /var/www/html/wp-admin/.htaccess - Find and remove (or comment out) this block:
<Files upgrade.php> Order Allow,Deny Deny from all</Files>You can comment out each line with
#or simply delete them. - Save the file and exit the editor.
- No need to restart Apache or your container. Changes to
.htaccessare applied immediately. - Retry your upgrade.
You should now be able to accesshttps://yourdomain.com/wp-admin/upgrade.phpwithout the 403 error and complete your WordPress update as intended.
Should You Restore the Rule Afterwards?
If you are security conscious, you might want to restore the restriction after the update. However, for most users (especially if your site is behind authentication), this is usually not necessary.
Pro tip: For better security, limit access to upgrade.php and install.php by IP address, instead of denying all access. For example:
<Files upgrade.php> Order Deny,Allow Deny from all Allow from 192.168.0.0/16</Files>(Adjust the IP range to match your internal network.)
Conclusion: WordPress Docker 403 Upgrade Error Fixed!
The 403 error on WordPress upgrade.php inside Docker is usually caused by restrictive .htaccess rules. A quick edit is all you need to get your WordPress upgrade working again.
Happy updating!
Did this guide help? Have a Docker or WordPress question? Let us know in the comments below!
