We are trying to install wordpress on nginx on docker. The domain pointing to it is ssl enabled and when accessing the website, html is loading well but css, js, images are all lost.
The reason is html still using wordpress hostname(which i think only work locally on docker containers) to embed css, js, image files from docker container that running the wordpress image.
here where I inspect: https://i.stack.imgur.com/N5YO6.png
my nginx config:
server {
listen 80;
server_name my_domain.com www.my_domain.com;
# Redirect http to https
location / {
return 301 https://my_domain.com$request_uri;
}
}
server {
listen 443 ssl http2;
...
location / {
proxy_pass http://wordpress_host:80;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
proxy_pass http://wordpress_host:80;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off; access_log off;
}
location = /robots.txt {
log_not_found off; access_log off; allow all;
}
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
How can I config nginx, wordpress to resolve this?