Closed cstromquist closed 7 years ago
So I found it has to do with the default port 80 which is currently used on my machine. How could I make this work on a different port like 81?
You're on the right track in the docker-compose.yml
that you pasted above. But WordPress is redirecting you to port 80 because it thinks the canonical URL is http://project.dev
.
You can run these WP-CLI commands to update WordPress's canonical URL:
docker-compose exec wordpress wp option update home http://project.dev:8080/
docker-compose exec wordpress wp option update siteurl http://project.dev:8080/
(Where project.dev
is your DOCKER_DEV_DOMAIN
and 8080
is the local port defined by the ports
property of the proxy
section of your docker-compose.yml
.)
Got it that worked, thanks a lot!
Noting here that the latest version correctly respects the WORDPRESS_SITE_URL
env variable. In the example above, simply set that variable to http://project.dev:8080
when bringing up the stack. No need to run the WP-CLI commands. Note however that this must be done on initial up
. Changing it later has no effect.
Awesome, thanks Chris!
Hi Chris,
Great repo. But am having an issue with connecting to my project.dev link. I followed the docs and have project.dev in /etc/hosts. But when I spin up Docker, I keep getting a 503 Service Unavailable error. Would you happen to know why I get that?
I'm trying to use Guzzle to connect as a client to test my REST API, but my url doesn't appear to be working.
Here's my .env:
docker-compose.yml:
Thank you, Chris