Home Domain Help News About

How to Fix Common HTTP Errors in WordPress on a Linux VPS (Step-by-Step Guide)

How to Fix Common HTTP Errors in WordPress on a Linux VPS (Step-by-Step Guide)

If you run a WordPress site on a Linux VPS, you've almost certainly run into a vague "HTTP error" at some point. You try to upload an image, save a post, or load a page โ€” and instead of working, you get a generic error message with no explanation.

The frustrating thing about WordPress HTTP errors is that they can be caused by โ€Œdozens of different thingsโ€Œ: PHP settings, file permissions, memory limits, plugin conflicts, server modulesโ€ฆ the list goes on.

In this guide, I'll walk you through the โ€Œ6 most common causes of HTTP errors in WordPressโ€Œ, show you how to diagnose each one, and give you exact commands to fix them on a Linux VPS. We'll cover everything from quick PHP config tweaks to debugging misbehaving plugins.

Let's dive in.


Before You Start: A Quick Diagnostic Tip

Before trying every fix in this guide, โ€Œcheck your server error logs firstโ€Œ. This will save you a ton of time.

Most HTTP errors are logged somewhere on your server. On a typical Linux VPS:

  • โ€ŒApacheโ€Œ error log: /var/log/apache2/error.log or /var/log/httpd/error_log
  • โ€ŒNginxโ€Œ error log: /var/log/nginx/error.log
  • โ€ŒPHP-FPMโ€Œ error log: /var/log/php-fpm/www-error.log or similar (depends on your PHP version)

Check the end of the log right after triggering the error:

bash
ย 
tail -50 /var/log/nginx/error.log

The error message there will usually point you straight to the cause. If you're not sure what it means, just keep reading โ€” we've got the most common fixes below.


Fix 1: HTTP Error When Uploading Images (PHP Upload Limits)

โ€ŒThe Problem:โ€Œ You try to upload an image or file in WordPress, and you get an "HTTP error" or "the uploaded file exceeds the upload_max_filesize directive" message.

This is by far the most common WordPress HTTP error, and 9 times out of 10 it's caused by PHP's upload limits being too low.

Step 1: Find Your php.ini File

First, locate your PHP configuration file. Run this command:

bash
ย 
php -i | grep "php.ini"

You'll see output like this:

text
ย 
ย 
Configuration File (php.ini) Path => /etc/php/8.1/cli Loaded Configuration File => /etc/php/8.1/cli/php.ini

The exact path varies depending on your Linux distribution and PHP version. โ€ŒNote:โ€Œ if you're using PHP-FPM with a web server, the web-facing php.ini is often in a different location (e.g., /etc/php/8.1/fpm/php.ini) than the CLI one. If in doubt, create a phpinfo.php file in your WordPress directory to check.

Step 2: Edit php.ini and Raise the Limits

Open the php.ini file in your favorite editor (vim, nano, whatever you prefer):

bash
ย 
nano /etc/php/8.1/fpm/php.ini

Find and update these settings:

ini
ย 
ย 
ย 
ย 
ย 
upload_max_filesize = 64M post_max_size = 128M max_execution_time = 300 max_input_time = 300 memory_limit = 256M

โ€ŒQuick explanation of each:โ€Œ

  • upload_max_filesize โ€” maximum size of a single uploaded file
  • post_max_size โ€” maximum size of all POST data combined (must be bigger than upload_max_filesize)
  • max_execution_time โ€” how long PHP can run before being killed (raise this for big uploads)
  • max_input_time โ€” how long PHP can spend parsing input data
  • memory_limit โ€” maximum memory a PHP script can use

Save and exit (in nano: Ctrl+O, Enter, Ctrl+X).

Step 3: Restart PHP and Your Web Server

For the changes to take effect, you need to restart PHP-FPM and your web server:

bash
ย 
ย 
ย 
ย 
ย 
ย 
# If using PHP-FPM + Nginx: systemctl restart php8.1-fpm systemctl restart nginx # If using Apache with mod_php: systemctl restart apache2 # or httpd on CentOS/RHEL

Alternative: .htaccess Method (Apache Only)

If you're on Apache and don't want to edit php.ini (or don't have root access), you can add these lines to your .htaccess file in the WordPress root directory:

apache
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
php_value upload_max_filesize 64M php_value post_max_size 128M php_value max_execution_time 300 php_value max_input_time 300 php_value memory_limit 256M # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress

Alternative: Nginx Method

If you're using Nginx, you also need to set client_max_body_size in your server block to match. Otherwise Nginx will reject large uploads before they even reach PHP:

nginx
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
server { listen 80; server_name your-domain.com www.your-domain.com; root /var/www/html/wordpress; index index.php; # Increase max upload size client_max_body_size 128m; client_body_timeout 300s; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }

Save the config and reload Nginx:

bash
ย 
nginx -t && systemctl reload nginx

โš ๏ธ โ€ŒImportant:โ€Œ Make sure fastcgi_pass matches your actual PHP-FPM socket path (e.g., /var/run/php/php8.1-fpm.sock) or TCP address (e.g., 127.0.0.1:9000). Check your PHP version โ€” the socket path varies.


Fix 2: HTTP Errors Caused by Incorrect File Permissions

โ€ŒThe Problem:โ€Œ Random HTTP errors, 403 Forbidden errors, or WordPress can't write files (uploads, plugins, themes, updates).

File permission issues are one of the most common causes of mysterious WordPress problems. If your files are owned by root or have the wrong permissions, PHP can't read or write to them properly.

The Fix: Set Correct Ownership and Permissions

First, figure out which user your web server runs as. On most Debian/Ubuntu systems it's www-data; on CentOS/RHEL it's usually apache or nginx.

bash
ย 
ย 
# Find the web server user (Apache/Nginx) ps aux | grep -E '(apache|nginx|httpd)' | head -5

Then fix all WordPress file ownership and permissions:

bash
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
# Replace www-data with your actual web server user # Replace /var/www/html/wordpress with your WordPress path # Fix ownership chown -R www-data:www-data /var/www/html/wordpress/ # Fix directory permissions (755 = readable/executable by all, writable by owner) find /var/www/html/wordpress/ -type d -exec chmod 755 {} \; # Fix file permissions (644 = readable by all, writable by owner) find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;

โ€ŒWhy these specific permissions?โ€Œ

  • Directories need to be executable (the x bit) so you can enter them
  • Files should NOT be executable for security reasons
  • 644 and 755 are the WordPress-recommended standard

Fix 3: HTTP Errors Caused by Insufficient PHP Memory

โ€ŒThe Problem:โ€Œ You get "HTTP error" or "Fatal error: Allowed memory size of X bytes exhausted" when doing things like updating plugins, importing content, or loading the admin area.

WordPress (plus plugins + themes) can be memory-hungry. The default PHP memory limit of 64MB or 128MB is often not enough, especially if you have a lot of plugins.

The Fix: Increase the WordPress Memory Limit

Add this line to your wp-config.php file, right before the "/* That's all, stop editing! */" line:

php
ย 
ย 
define('WP_MEMORY_LIMIT', '256M'); define('WP_MAX_MEMORY_LIMIT', '512M');
  • WP_MEMORY_LIMIT โ€” memory limit for the front-end of your site
  • WP_MAX_MEMORY_LIMIT โ€” memory limit for the admin area (can be higher)

โ€ŒNote:โ€Œ This only works if your server's PHP memory_limit in php.ini is at least as high. If php.ini sets a 128MB limit, WordPress can't magically override it to 256MB. Go back to Fix 1 and raise memory_limit in php.ini as well.


Fix 4: HTTP Errors Caused by Misconfigured PHP (cgi.fix_pathinfo, timezone, etc.)

โ€ŒThe Problem:โ€Œ Strange HTTP 500 errors, blank pages, or PHP scripts not executing correctly. Sometimes you'll see "No input file specified." errors (especially with Nginx + PHP-FPM).

A few PHP settings that are commonly misconfigured and cause weird issues:

4a. Fix cgi.fix_pathinfo (Security + Compatibility)

When cgi.fix_pathinfo is set to 1 (the default), PHP tries to "fix" the path info in URLs, which can cause security issues and compatibility problems with Nginx.

Edit your php.ini:

bash
ย 
nano /etc/php/8.1/fpm/php.ini

Find the cgi.fix_pathinfo line, uncomment it (remove the ; at the beginning), and set it to 0:

ini
ย 
cgi.fix_pathinfo = 0

Restart PHP-FPM:

bash
ย 
systemctl restart php8.1-fpm

4b. Set the Correct Timezone

If PHP's timezone doesn't match your server or WordPress settings, it can cause weird issues with scheduling, post dates, and cron jobs.

In php.ini, find and set:

ini
ย 
date.timezone = America/New_York

Replace America/New_York with your actual timezone. You can find the full list of supported timezones on the PHP website.

โ€ŒCommon values:โ€Œ

  • US East Coast: America/New_York
  • US West Coast: America/Los_Angeles
  • UK: Europe/London
  • China: Asia/Shanghai
  • Singapore: Asia/Singapore
  • Hong Kong: Asia/Hong_Kong

4c. Other PHP Settings Worth Checking

  • display_errors = Off โ€” should be off on production sites (log errors instead of displaying them)
  • log_errors = On โ€” make sure error logging is enabled
  • upload_tmp_dir โ€” make sure the temp upload directory exists and is writable

Restart PHP after making any changes:

bash
ย 
systemctl restart php8.1-fpm

Fix 5: HTTP Errors Caused by Apache mod_security False Positives

โ€ŒThe Problem:โ€Œ You get random 403 Forbidden errors, or specific WordPress actions fail (like saving certain posts, uploading files with specific names, or using certain plugins).

ModSecurity is an open-source web application firewall (WAF) that runs on Apache. It's great for security, but its rules can sometimes flag legitimate WordPress requests as attacks and block them โ€” resulting in an HTTP error.

How to Test if mod_security is the Culprit

Add this to the .htaccess file in your WordPress root:

apache
ย 
ย 
ย 
ย 
SecFilterEngine Off SecFilterScanPOST Off

Then try the action that was failing. If it works now, โ€Œmod_security was causing the problem.โ€Œ

โš ๏ธ โ€ŒImportant:โ€Œ Don't leave mod_security disabled permanently! That's like taking the lock off your front door because you keep forgetting your key. Instead:

  1. Identify exactly which rule is being triggered (check the mod_security audit log);
  2. Whitelist only that specific rule for that specific endpoint;
  3. Keep mod_security enabled for everything else.

If you're not sure how to do that, ask your hosting provider for help โ€” it's a common request.


Fix 6: HTTP Errors Caused by Plugin or Theme Conflicts

โ€ŒThe Problem:โ€Œ HTTP errors that started right after you installed, updated, or activated a plugin or theme.

WordPress's plugin ecosystem is amazing, but it's also the source of most problems. A poorly coded plugin, a theme conflict, or an outdated extension can cause all kinds of weird errors.

Step 1: Disable All Plugins

The fastest way to test if a plugin is causing the issue is to disable them all at once. There are two easy ways to do this:

โ€ŒMethod A: Rename the plugins folder (via SSH)โ€Œ

bash
ย 
ย 
# Replace the path with your actual WordPress path mv /var/www/html/wordpress/wp-content/plugins /var/www/html/wordpress/wp-content/plugins.bak

This instantly disables all plugins. If the error goes away, you know it's a plugin issue. Rename the folder back, then disable plugins one by one until you find the culprit.

โ€ŒMethod B: Use phpMyAdmin or WP-CLIโ€Œ

If you have phpMyAdmin or database access, you can disable all plugins by running this SQL query:

sql
ย 
UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins';

Or if you have WP-CLI installed:

bash
ย 
wp plugin deactivate --all

Step 2: Switch to a Default Theme

If disabling plugins doesn't fix it, try switching to a default WordPress theme like Twenty Twenty-Four. Theme conflicts are less common than plugin conflicts, but they do happen.

Via WP-CLI:

bash
ย 
wp theme activate twentytwentyfour

Or rename your current theme's folder via SSH โ€” WordPress will automatically fall back to a default theme.

Step 3: Re-enable One by One

Once the error is gone, re-enable plugins/themes one at a time, testing after each one. When the error comes back, you've found the culprit.

Then you can:

  • Update the problematic plugin/theme to the latest version
  • Find an alternative plugin that does the same thing
  • Contact the developer for support
  • Hire someone to fix the conflict

Bonus: 5 Quick Checks When You've Tried Everything

If you've gone through all 6 fixes above and still have the error, try these quick checks:

1. Check Disk Space

If your server is out of disk space, nothing works properly โ€” uploads fail, PHP sessions break, and you get vague HTTP errors.

bash
ย 
df -h

If the Use% column shows 95%+, you need to free up space or upgrade your disk.

2. Check Inode Usage

Even if you have free disk space, running out of inodes (file system entries) causes the same symptoms.

bash
ย 
df -i

3. Check if mod_security or a WAF is blocking requests

We covered this in Fix 5, but it's worth double-checking โ€” especially if errors only happen with certain actions or specific content.

4. Test with a Different Browser / Incognito Window

Sometimes it's a browser issue โ€” cache, cookies, extensions. Rule that out first before digging into server config.

5. Enable WordPress Debug Mode

Add these lines to wp-config.php to get more detailed error messages instead of just "HTTP error":

php
ย 
ย 
ย 
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);

Errors will be logged to wp-content/debug.log instead of shown on screen, which is safe for production sites.


Summary: WordPress HTTP Error Troubleshooting Flowchart

Here's the order I recommend debugging in:

  1. โ€ŒCheck error logsโ€Œ (web server + PHP) โ€” 80% of the time this tells you exactly what's wrong
  2. โ€ŒCheck PHP upload limitsโ€Œ โ€” if the error happens during uploads
  3. โ€ŒCheck file permissionsโ€Œ โ€” 403 errors or "can't write" issues
  4. โ€ŒIncrease memory limitโ€Œ โ€” if it happens during heavy operations
  5. โ€ŒDisable all pluginsโ€Œ โ€” if it's a random/weird error
  6. โ€ŒCheck mod_security / WAFโ€Œ โ€” 403 errors with no obvious cause
  7. โ€ŒCheck disk space and inodesโ€Œ โ€” when all else fails

Most WordPress HTTP errors can be fixed in under 15 minutes if you know where to look.


๐Ÿ’ป โ€ŒLooking for a WordPress-optimized VPS?โ€Œ

โ€Œsixcvmโ€Œ offers high-performance KVM VPS perfect for running WordPress, with:

  • โšก โ€ŒNVMe SSD storageโ€Œ โ€” fast disk I/O for quick page loads and smooth uploads;
  • ๐Ÿ˜ โ€ŒPHP 8.x optimizedโ€Œ โ€” latest PHP versions with OPcache and proper defaults;
  • ๐ŸŒ โ€ŒOptimized network routesโ€Œ โ€” low latency for visitors from all over the world;
  • ๐Ÿ›ก๏ธ โ€ŒFree DDoS protectionโ€Œ โ€” 20Gbps baseline included;
  • ๐Ÿ‘จโ€๐Ÿ’ป โ€Œ24/7 technical supportโ€Œ โ€” if you run into issues, we'll help you fix them;
  • ๐Ÿ’ฐ โ€Œ3-day money-back guaranteeโ€Œ โ€” try it risk-free.