So I have a simple two containers one is php-fpm and other is nginx

CONTAINER ID        IMAGE                 COMMAND                  CREATED              STATUS              PORTS                                            NAMES
6c529316f873        nginx:mainline        "nginx -g 'daemon of…"   About a minute ago   Up About a minute>80/tcp,>443/tcp         Nginx
d255a92b102f        php:fpm               "docker-php-entrypoi…"   About an hour ago    Up About an hour>3000/tcp,>9000/tcp   PHP

Here is my nginx conf file

server {
    listen 80;
    listen [::]:80;
    return 301 https://$host$request_uri;

server {
    listen 443 ssl http2;

    root /var/www/html/;
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;

    ssl_protocols TLSv1.2;

    index index.html index.htm index.php;

    charset utf-8;

    ssl_certificate    /etc/nginx/certs/;
    ssl_certificate_key    /etc/nginx/certs/;

    # Dynamically set the try_files locations.
    # Statically cached files should only be loaded for GET requests.
    set $try_files @default;
    if ($request_method = GET) {
        set $try_files @static;

    # The files to try when its a potentially static cache request (ie. a GET request)
    location @static {
        try_files /static${uri}_${query_string}.html @default;

    # The files to try when it's not a static cache request (ie. anything other than GET)
    location @default {
        try_files $uri $uri/ /index.php?$query_string;

    location / {
        try_files $uri $try_files; # Use the dynamically assigned locations from above.

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass PHP:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_index index.php;
        include fastcgi_params;

    # Block access to hidden files (except the /.well-known/ dir)
    location ~ /(?!.well-known)(\.)\w+ {
        deny all;

    # Block access to content/data files
    location ~* /(.*)\.(?:md|yaml|textile)$ {
        deny all;
        return 404;

    # Block access to the Statamic app
    location ^~ /statamic {
        deny all;
        return 404;

    # Enable gzip compression
    # gzip on;
    # gzip_min_length  1100;
    # gzip_buffers  4 32k;
    # gzip_types    text/plain application/x-javascript text/xml text/css;
    # gzip_vary on;

But homepage or any other fronted page is not loading CSS and JS file, all reporting 404. (Control Panel is loading everything)

HomePage CSS and JS Error

To Debug it more i manually run php -S localhost:3000 statamic/server.php in PHP-FPM, on https://IP:3000 everything is working great.

Folder Permissions are 755.

Please Point me where nginx configuration going wrong.