After docker deploys nginx reverse proxy wordpress, it adds a layer of /wp access path and cannot access it.

  docker, question

Now nginx runs on one container and wordpress runs on one container (wordpress is the latest official image dragged on dockerhub and is a php program running on apache server). The two containers are independent of each other. Want tohttp:// address is accessed to wordpresshttp:// 8000 visits).

Nginx partial code

server {
 # Listening Port Number
 listen  80;
 # Service Name
 location /wp/ {
 root   html;
 index   index.html  index.htm  index.php ;
 # Reverse proxy path
 # Timeout for reverse proxy
 proxy_connect_timeout 10;

WordPress runs as a docker container on the 8000 port of the machine

The wordpress service in docker-compose wrote this (mysql is another container, don’t pay attention to this).

 image: wordpress
 container_name: wordpress
 restart: always
 - 8000:80
 - mysql
 WORDPRESS_DB_HOST: mysql:3306

However, the wordpress page cannot be accessed in this way. The in the figure below is a springboard machine. If you don’t understand it, you can roughly understand it as the machine.


After accessing, the address bar will automatically locate to /wp-admin/install.php, but the page cannot be displayed, as shown in the following figure.


Normally this page is correct (please ignore this port number because this is a separate service).


When requesting, the address of the reverse proxy is, then WordPress is redirected to /wp-admin/install.php, and then nginx cannot find the corresponding location:/WP-admin
I haven’t used wordpress and I don’t know the url configuration. I can try to change the nginx location configuration to /wp-admin/