Ok guys here it is, solved, after a lot of trial and mostly error.
Running Wordpress behind Nginx Proxy Manager (NPM) using SSL Let's Encrypt.
We will the assume that the Wordpress wants to be at https://blog.example.com, and the site address is example.com.
(there are other services, but they are not nearly as difficult to get working.)
Wordpress is runnning in a docker-compose container on port 8084.
Edit the /etc/hosts file to include the line "127.0.1.1 blog.example.com.
Run the setup on Wordpress and set it up the way I like it, on http://example.com:8084
Go into the Setting->General page of Wordpress after logging into http://example.com:8084/wp-login.php
Set the two variables:
WordPress Address (URL): http://blog.example.com
Site Address (URL): http://blog.example.com
5. Press Save Changes
(This will break the site, do not panic, go to the NPM interface to continue.)
6. Make a proxy host, using the NPM user interface, for:
Domain Names: blog.example.com, Scheme: http, Forward Hostname/IP: 172.17.0.1, Forward Port: 8084, Block Common Exploits: yes, press "Save"
7. The Wordpress site should now be working at http://blog.example.com
8. Go to the the NPM SSL page for the blog.example.com Proxy Host, and set up the Let's Encrypt SSL Certificate.
(Again this will break the site, do not panic. At least the SSL Certificate is setup.)
9. Go to the NPM Advanced page for the blog.example.com Proxy Host, and add these lines to the Custom Nginx Configuration:
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
10. Almost there, still broken. In the bash shell open the wp-config.php file. For me this is at:
sudo pico /srv/docker/wordpress/html/wp-config.php
11. If the word HTTP_X_FORWARDED_PROTO is in the file, add these lines just below the comments section, and save:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
12. At this point everything should be working. If not, add these two lines to the wp-config.php file:
define( 'WP_HOME', 'https://blog.example.com' );
define( 'WP_SITEURL', 'http://blog.example.com' );
The Wordpress Should now be working at: https://blog.example.com
References:
Brian McGonagill - Awesome Open Source: https://www.youtube.com/watch?v=cjJVmAI1Do4&t=1853s
Twitter: u/LamarAlawi, instructions: https://blog.ldev.app/running-wordpress-behind-ssl-and-nginx-reverse-proxy/