wordpress home url redirects to localhost
-
I’m using WordPress + mysql + phpmyadmin with docker-compose and a reverse proxy with nginx in the host machine to send all requests to the wordpress container. After the wordpress installation I’ve set “site_url” and “home” option names to “https://example.com”. Everything works fine when I’m browsing https://example.com/wp-admin but when I try with https://example.com it redirects me to localhost. Everything is in a remote server and I’m doing these requests from my browser and not from the server itself. This is my nginx conf:
server { listen 80; listen [::]:80; server_name example.com proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { proxy_pass https://localhost:8000; } }
and this is the docker-compose file:
version: '3.3' services: db: image: mysql:5.7 volumes: - /home/wordpress/mysqldb:/var/lib/mysql restart: always environment: MYSQL_ROOT_PASSWORD: rootpass MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpresspass wordpress: depends_on: - db image: wordpress:latest volumes: - /home/wordpress/wordpress/html:/var/www/html ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpresspass WORDPRESS_DB_NAME: wordpress phpmyadmin: depends_on: - db image: phpmyadmin/phpmyadmin restart: always ports: - '8080:80' environment: PMA_HOST: db MYSQL_ROOT_PASSWORD: rootpass
If I set the option name with ServerIp:8000 the address https://example.com works but everything else redirects with the ServerIp and I’d like to use the domain name. Am I missing something with the wordpress options?
- The topic ‘wordpress home url redirects to localhost’ is closed to new replies.