WordPress being wonky behind a reverse proxy

[ad_1]

I have the WordPress docker container running on port 81 on a server at my home, which is VPNed into a network with a remote server with a static IP and my domain name on it. I have NGINX set up on the remote server, redirecting port 80 to 443 and forcing certificate use, then forwarding [www.mydomain.com]) to port 81 on my home server. It’s on 81 because the webmail of my mail server is already on 80. The webmail interface works great through [mail.mydomain.com]), so I know the reverse proxy’s functioning.

At first, the WordPress container would only work locally if I put in the IP and completely failed to respond on [www.mydomain.com]). Then thanks to other people pointing it out, I found the URL setting in the WordPress config and changed it from the local IP address to [https://www.mydomain.com]). At that point I could reach the home page, but [https://www.mydomain.com/wp-admin]) wouldn’t load and a lot of the graphical elements on the home page are missing, so it is clearly having issues. For reference, here is the section pointing to WordPress in the NGINX config; the [10.10.10.2]) is my local server’s IP on the VPN and it’s listening on 443 because there’s another section listening on 80 that redirects incoming to 443:

server {

server\_name [www.mydomain.com]) mydomain[.com]);

location / {

proxy\_pass [http://10.10.10.2:81]);

proxy\_http\_version 1.1;

proxy\_set\_header Upgrade $http\_upgrade;

proxy\_set\_header Connection ‘upgrade’;

proxy\_set\_header Host $host;

proxy\_cache\_bypass $http\_upgrade;

}

listen \[::\]:443 ssl http2; # managed by Certbot

listen 443 ssl http2; # managed by Certbot

ssl\_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot

ssl\_certificate\_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

ssl\_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer