How do I change the port for my WordPress Docker setup?

0
19
Asked By CuriousCucumber42 On

I'm running WordPress in a Docker container with the current port mapping set to 8080:80. I want to change the port to either 8999:80 or 8111:80, but when I try these configurations, WordPress doesn't run, and I can't find anything in the logs to help me troubleshoot. I used 'docker compose down -v' to stop the container before making changes. I'm still pretty new to Docker and server management. Does anyone have any ideas on how to make this work?

4 Answers

Answered By ProxyPal54 On

It sounds like you're running into some issues with Nginx Proxy Manager where it's conflicting with your current setup. If Nginx is using port 8080 already, that’s probably why you can't get WordPress to work on the same port. Changing the port for WordPress is a good idea to avoid these conflicts, so make sure to update the proxy settings according to the new port you choose.

Answered By DockerDude99 On

Your port mapping syntax looks good—like 8999:80 should work! But certain web apps, including WordPress, might require a base URL that matches the port to function correctly. Make sure you're using 'docker compose up' instead of 'docker compose start' after making your changes; using 'start' won’t apply the new configurations.

Answered By HelpfulHedgehog87 On

One thing to keep in mind is that WordPress saves the external URL internally, which means it’s likely still using the first port you set up. You’ll need to edit the wp-config.php file and update the WP_HOME and WP_SITEURL variables to match the new port you’re trying to use. Alternatively, you could set up a reverse proxy like Caddy or Traefik and route all your services through that on ports 80/443.

Answered By NinjaNerd76 On

Sharing your Dockerfile and docker-compose.yaml files can help us get a clearer picture of your setup. Just remember the syntax for port mapping: :. This means if you use 8080:80, it exposes 8080 on your host and directs that traffic to port 80 inside the container. You can’t just switch everything to 8111 because WordPress is set to serve traffic on port 80 by default. Also, you'll probably need to tweak those settings after launching the container to make sure it recognizes the new port.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.