nginxinc / docker-nginx

Official NGINX Dockerfiles
BSD 2-Clause "Simplified" License
3.22k stars 1.73k forks source link

Nginx 1.15.8 unable to serve static assets files LEMP stack. #304

Closed leeliwei930 closed 5 years ago

leeliwei930 commented 5 years ago

I have tried to setup a LEMP stack environment in Docker for my Laravel application, all the php and routing goes well except my nginx unable to serve any static assets files which locate in public directories and keep returning 404 not fouend error on the fronend. Does anyone know how to resolve this issues?

/etc/nginx/conf.d/default.conf

server {
    listen 80;
    index index.php index.html;
    root /var/www/basic-chat-app/public;
    server_name basic-chat-app.test;
    charset utf-8;
    client_max_body_size 128M;
    location / {
    try_files $uri $uri/ /index.php?$query_string;
    include  /etc/nginx/mime.types;
    }

    location ~ \.php$ {

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php:9000;
        include fastcgi_params;
        include snippets/fastcgi-php.conf
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_index index.php;
    }

}
thresheek commented 5 years ago

Take a look at the error log and make sure files are indeed there whey are supposed to be.

thresheek commented 5 years ago

Closing due to feedback timeout.