docker-library / wordpress

Docker Official Image packaging for WordPress
https://wordpress.org/
GNU General Public License v2.0
1.79k stars 1.07k forks source link

Theme templates bug when port forwarding is different from host port 80 #887

Closed git-davi closed 8 months ago

git-davi commented 8 months ago

Using docker compose yaml file:

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 80:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mysql:8.0
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:

Seems to work fine.

But if the ports are mapped like 8080:80 (as suggested on the docker HUB guide) , or any other port eg 8000:80 etc. The theme templates stop working. (I tested only on kadence and astra).

LaurentGoderre commented 8 months ago

It worked for me when I started the site with the different port. Perhaps the issue is with changing the port after the installation? If so there's an article on how to fix that:

https://www.serverlab.ca/tutorials/linux/web-servers-linux/how-to-change-port-80-to-8080-for-wordpress/