I'm running a wordpress docker instance on server 192.168.1.105:4444. On a separate server on my LAN I have nginx acting as a reverse proxy pointing my domain to it. I am able to load html, but images and css are not loading. There are many posts about this error, but it seems like there can be many things that cause this error specifically. I would appreciate someone reviewing my config for errors:
Here's my config file so far.
server {
server_name test1.example.com www.test1.example.com;
location / {
proxy_pass http://192.168.1.105:4444;
# 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;
# proxy_set_header Host $host;
# proxy_set_header X-Forwarded-Host $host;
# proxy_set_header X-Forwarded-Port $server_port;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/test1.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/test1.example.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
}
server {
if ($host = www.test1.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = test1.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name test1.example.com www.test1.example.com;
listen 80;
return 404; # managed by Certbot
}
Note: the commented section is troubleshooting that I have tried based on this tutorial: link
If I remove the comments the error becomes "refused to connect" and the url in the browser redirects from test1.example.com to test1.example.com:4444
When Wordpress is installed the default website address it uses is whatever local address you had installed it on.
Once you set your domain to point at this address, you must also change the wordpress URL under settings > general to your domain eg. https://example.com
If you don't, all your css, images, and internal links will point towards your LAN ip, instead of your domain. Thus, when you check that outside of your network none of the css and images will load.