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

381
Views
Docker nginx file not found

Why is this simple solution not working?

I try to mount the directory with wordpress to the directory on the nginx webserver, but when I switch to localhost:80, I get the error: File not found.

Wordpress files are visible on the web server, I checked this with the "ls" command. docker exec -it webserver sh ls /var/www Everything is OK, there is a wordpress directory and files inside. But in the browser, he still does not see them! It returns a File not found error. What is the problem?

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;
        }
}
over 4 years ago · Santiago Trujillo
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!