Initial Situation
I had a WordPress site running inside a single Docker container on an Ubuntu server hosted on Oracle Cloud. This container included both the WordPress application and the Apache web server. The container’s port 80 was mapped to the host’s port 8080, allowing access to the site via http://207.211.xxx.xxx:8080
. I owned the domain leeveschou.com
and wanted to serve the WordPress site securely over HTTPS using this domain.
Purpose
The goal was to configure a reverse proxy setup so that requests to https://leeveschou.com
would be securely routed to the WordPress site running inside the Docker container. I preferred to use Apache, which was running inside the Docker container alongside WordPress. The aim was to:
- Serve the WordPress site on the standard HTTPS port (443) under my domain.
- Use SSL certificates I already had.
- Avoid exposing the non-standard port 8080 to users.
- Ensure smooth, secure access to the WordPress site.
Issues Encountered and How They Were Solved
1. Volume Mounting SSL Certificates into the Container
When configuring Apache inside the container to use SSL, Apache reported that the certificate files did not exist at the expected path.
Problem: The Docker volume mount for SSL certificates was not working correctly.
Solution:
- Verified the SSL certificate files existed on the host with correct permissions
- Ensured the absolute host path was correctly specified in the
docker-compose.yml
volumes section - Restarted the container to apply the updated volume mount
– Verified inside the container that the SSL files were accessible at /etc/apache2/ssl/
2. Redirects to Port 8080
After setting up SSL, accessing https://leeveschou.com
resulted in a redirect to https://leeveschou.com:8080/
, which was inaccessible externally.
Cause:
WordPress’s Site Address (URL) and WordPress Address (URL) were still set to http://207.211.xxx.xxx:8080
, causing WordPress to redirect to that port.
Solution:
- Updated both URLs in the WordPress admin dashboard to
https://leeveschou.com
. - Alternatively, updated the URLs directly in the SQLite database used by WordPress.
- Ensured Apache inside the container had no redirect rules forcing port 8080.
- Restarted Apache and cleared browser cache.
Leave a Reply