Wordpress 未找到Docker nginx文件

Wordpress 未找到Docker nginx文件,wordpress,nginx,Wordpress,Nginx,为什么这个简单的解决方案不起作用 我尝试使用wordpress将目录装载到nginx Web服务器上的目录,但是当我切换到localhost:80时,我得到错误:File not found Wordpress文件在web服务器上可见,我用“ls”命令检查了这一点。 docker exec-it Web服务器sh ls/var/www 一切正常,里面有wordpress目录和文件。但在浏览器中,他仍然看不到它们!它返回一个文件未找到错误。有什么问题 docker compose.yml vers

为什么这个简单的解决方案不起作用

我尝试使用wordpress将目录装载到nginx Web服务器上的目录,但是当我切换到localhost:80时,我得到错误:File not found

Wordpress文件在web服务器上可见,我用“ls”命令检查了这一点。 docker exec-it Web服务器sh ls/var/www 一切正常,里面有wordpress目录和文件。但在浏览器中,他仍然看不到它们!它返回一个文件未找到错误。有什么问题

docker compose.yml

version: '3.7'

services:
  wordpress:
    image: wordpress:5.1.1-fpm-alpine
    container_name: wordpress
    volumes:
      - wordpress_volume:/var/www/html 
    networks:
      - app-network

  webserver:
    depends_on:
      - wordpress
    image: nginx:1.15.12-alpine
    container_name: webserver
    ports:
      - "80:80"
    volumes:
      - wordpress_volume:/var/www/wordpress
      - ./nginx-conf:/etc/nginx/conf.d
    networks:
      - app-network

volumes:
  wordpress_volume:

networks:
  app-network:
    driver: bridge  
nginx.conf

server {
        listen 80;
        listen [::]:80;

        index index.php index.html index.htm;

        root /var/www/wordpress;

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass wordpress:9000;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
        }

        location ~ /\.ht {
                deny all;
        }

        location = /favicon.ico {
                log_not_found off; access_log off;
        }
        location = /robots.txt {
                log_not_found off; access_log off; allow all;
        }
        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
                expires max;
                log_not_found off;
        }
}