
If your self-hosted Ghost blog keeps redirecting to https://127.0.0.1:2368 instead of your actual domain, this guide will help you troubleshoot and fix the issue. This is quite common with Bitnami Ghost setups on AWS Lightsail when reverse proxy isn’t configured properly.
Step 1: Update config.production.json
- SSH into your server
ssh bitnami@your-server-ip
or use lightsail’s connect option directly.
- Open the config file
sudo nano /opt/bitnami/ghost/config.production.json - Edit the URL field:
"url": "https://your-domain.com"Important: Do not use localhost or 127.0.0.1!
- Save and exit (
Ctrl+OthenCtrl+X).
Step 2: Fix Apache Reverse Proxy (VHost)
- Edit the Apache vhost config
sudo nano /opt/bitnami/apache2/conf/vhosts/ghost-https-vhost.conf - Use this configuration block:
<VirtualHost 127.0.0.1:443 _default_:443> ServerName your-domain.com ServerAlias www.your-domain.com SSLEngine on SSLCertificateFile "https://digitalconqueror.b-cdn.net/opt/bitnami/apache/conf/your-domain.com.crt" SSLCertificateKeyFile "https://digitalconqueror.b-cdn.net/opt/bitnami/apache/conf/your-domain.com.key" ProxyPreserveHost On RequestHeader set X-Forwarded-Proto "https" ProxyPass /.well-known ! ProxyPass / http://127.0.0.1:2368/ ProxyPassReverse / http://127.0.0.1:2368/ </VirtualHost>
- Save and exit.
Step 3: Check mod_headers (Required for Proxy Headers)
sudo /opt/bitnami/apache2/bin/apachectl -M | grep headers- If nothing shows, edit:
sudo nano /opt/bitnami/apache2/conf/httpd.conf
and make sure this line is uncommented:LoadModule headers_module modules/mod_headers.so
Step 4: Test Configuration
sudo /opt/bitnami/apache2/bin/apachectl configtest
If it says Syntax OK, proceed!
Step 5: Restart Services
sudo /opt/bitnami/ctlscript.sh restart ghost sudo /opt/bitnami/ctlscript.sh restart apache
Step 6: Clear Browser Cookies & Cache
- Delete cookies for your site (Settings > Privacy > Cookies)
- Try in Incognito mode for fresh session
Troubleshooting Common Errors
ERR_TOO_MANY_REDIRECTS
- Add
RequestHeader set X-Forwarded-Proto "https"to Apache config
ERR_CONNECTION_REFUSED
- Run
sudo /opt/bitnami/apache2/bin/apachectl configtestand fix any syntax errors shown
EACCES: permission denied
- Use
sudoor fix file ownership:sudo chown -R ghost:ghost /opt/bitnami/ghost
Verification Checklist
- Visit
https://your-domain.com(should load, not redirect) - Ghost admin panel at
https://your-domain.com/ghostworks - No redirects to localhost
Why This Happens
Ghost sees requests as HTTP unless proxy headers are set. The solution is correct headers + correct config file.
Conclusion
Combine a valid config.production.json and proper proxy headers in Apache, restart services, and your Ghost site will work perfectly with your custom domain.










