Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

232
Views
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 "http://example.com". Everything works fine when I'm browsing http://example.com/wp-admin but when I try with http://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 http://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 http://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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The problem was a simple syntax error. I used the command “service nginx restart” to restart and use a new nginx configuration but restart doesn’t show errors and falls back quietly to an old config. A simple ‘;’ was missing from the server name.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!