Here are a few times when HTTPS gives you the 500 error:
- You enabled HTTPS not too long ago, but you didn’t update all of the internal URLs.
- The SSL certificate from Let’s Encrypt didn’t renew.
- Using .htaccess, HTTP traffic is being forced to go to HTTPS, although SSL isn’t available.
- The GCP Load Balancer isn’t sending SSL headers correctly.
- You changed the name of your site or domain but didn’t update the URLs.
Step 1: Confirm It’s a 500 Error
Before diving in:
- Open your site in Incognito.
- Press F12 to open Developer Tools and go to the “Network” tab.
- Refresh the page and check the response code. A 500 error will be clearly visible.
You can also use curl from your terminal:
bash
curl -I https://yourdomain.com
Step 2: Check HTTPS and SSL Certificate Setup
Use the following tools:
- SSL Checker (e.g., https://www.sslshopper.com)
- GCP Certificate Manager for certificate status
- Verify if the domain points to the correct IP
Check if the SSL is valid and matches your domain:
bash
openssl s_client -connect yourdomain.com:443
Make sure HTTPS is enabled in GCP:
- Go to GCP Console > Load Balancing > Frontend Configuration
- Ensure HTTPS (port 443) is set up with the correct certificate
Step 3: Review WordPress Configuration
Make sure the WordPress site URLs are set correctly in the database or wp-config.php:
php
define(‘WP_HOME’,’https://yourdomain.com’);
define(‘WP_SITEURL’,’https://yourdomain.com’);
Avoid conflicts with database-stored URLs.
Step 4: Inspect Error Logs
Check both Apache/Nginx logs and PHP logs. On GCP (especially with Bitnami stacks), logs are usually found at:
bash
/opt/bitnami/apache2/logs/error_log
/opt/bitnami/php/var/log/php-fpm.log
Use:
Bash
tail -n 50 error_log
Look for fatal errors, permission denials, or memory limit issues.
Step 5: Check .htaccess File
A corrupted .htaccess can easily trigger 500 errors during redirection.
To regenerate:
bash
mv .htaccess .htaccess.bak
Then log into the WordPress dashboard (if accessible) and go to:
Settings > Permalinks > Save
This will auto-generate a clean .htaccess.
Step 6: Increase PHP Memory Limit
Low memory can crash your WordPress site.
Edit wp-config.php:
php
define(‘WP_MEMORY_LIMIT’, ‘256M’);
Also update php.ini or .user.ini:
ini
memory_limit = 256M
Restart services:
bash
sudo /opt/bitnami/ctlscript.sh restart
Step 7: Disable Plugins Temporarily
Some plugins (especially for SSL/HTTPS redirection) may cause conflicts.
- Access your server via SSH or SFTP.
- Rename the plugins folder:
bash
mv wp-content/plugins wp-content/plugins-old
Check your site again. If it works, rename individual plugin folders to find the culprit.
Step 8: Switch to a Default Theme
A poorly coded theme can also throw a 500 error.
- Go to the WordPress database via phpMyAdmin or SSH.
- In the wp_options table, change:
cpp
template → twentytwentyfour
stylesheet → twentytwentyfour
Step 9: Permissions and Ownership Issues
File permissions on WordPress should be:
bash
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
And ownership (for Bitnami):
bash
sudo chown -R bitnami:daemon /opt/bitnami/wordpress
Step 10: Check PHP Version and Compatibility
Incompatible plugins or themes with the current PHP version can crash WordPress.
Check current PHP version:
bash
php -v
To change PHP version in GCP, you may need to modify your instance image or use Google App Engine flexible environment.
Step 11: Clear Cache and Restart Services
Caching issues from plugins or server can cause errors.
Clear all caches:
Restart Apache and PHP:
bash
sudo /opt/bitnami/ctlscript.sh restart apache
Step 12: Use GCP Load Balancer Correctly
If you’re using GCP’s HTTPS Load Balancer:
- Ensure that backend services are healthy.
- Set the correct HTTP to HTTPS redirect (don’t double-redirect).
- Headers like X-Forwarded-Proto must be passed.
In wp-config.php, force HTTPS:
php
if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’)
$_SERVER[‘HTTPS’]=’on’;
Step 13: Fixing Rewrite Rules and Mixed Content
HTTPS errors may sometimes stem from HTTP content being loaded, especially with plugins forcing redirects.
Use:
bash
grep -Ri “http://” wp-content/
Replace all HTTP references with HTTPS.
Leave a Reply