title: Nginx reverse proxy deeplinks Wordpress on Docker
body: <p>I'm trying to run Wordpress on Digital Ocean through Docker. Things started out well, I had it up and running in no time configured like so:</p>
  <pre><code>version: '3.3'
  services:
      wordpress:
          depends_on:
              - db
          image: wordpress:5.5.1-php7.2-apache
          container_name: wp
          restart: always
          volumes:
              - ./www/wp-content:/var/www/html/wp-content
          environment:
              WORDPRESS_DB_HOST: db:3306
              WORDPRESS_DB_PASSWORD: ${DB_PWD}
          ports:
              - 3010:80
          networks:
              - network
      db:
          image: mysql:5.7
          container_name: db
          restart: always
          volumes:
              - ./dbdata:/var/lib/mysql
          environment:
              MYSQL_ROOT_PASSWORD: ${DB_PWD}
          networks:
              - network
      phpmyadmin:
          depends_on:
              - db
          image: phpmyadmin/phpmyadmin
          container_name: pma
          restart: always
          ports:
              - 3011:80
          environment:
              PMA_HOST: db
              MYSQL_ROOT_PASSWORD: ${DB_PWD}
              UPLOAD_LIMIT: 20000000
          networks:
              - network
  networks:
      network:
  volumes:
      db_data:
  </code></pre>
  <p>On the Digital Ocean droplet I configured Nginx as a reverse proxy:</p>
  <pre><code>server {
      listen 80;
      listen [::]:80;
  
      server_name my.test.url;
  
      location / {
          rewrite /(.*) /$1 break;
          proxy_pass http://localhost:3010;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
      }
  }
  </code></pre>
  <p>I already had my.test.url pointing to the droplet's IP.
  I updated the 'siteurl' and 'home' records in the wp_options table in the database to my.test.url</p>
  <p>This all worked well, serving the homepage if I visit my.test.url. However when I visit a deep link, like my.test.url/example I get redirected to 127.0.0.1/example where obviously nothing is running.</p>
  <p>I don't know how to proceed; I thought setting the rewrite rule in the nginx config would do the trick but alas..</p>
  <p>I should mention I want to run multiple sites on the Digital Ocean droplet, each serving from their own port, so 'just' serving from port 80 is not an option.</p>
  <p>Can anyone point me in the right direction?</p>