Nginx无法打开文件但文件存在

时间:2018-01-21 22:20:15

标签: symfony docker nginx

我正在研究symfony 4应用程序。网站在docker容器中使用let的加密证书。

资产链接存在问题:

<script src="/build/js/app.js"></script>

链接很好,但我有这个问题:

nginx issue

App.js路径:

app.js path

我的nginx配置:

server {
    listen      80;
    server_name esgi.be;

    location ^~ /.well-known {
        allow all;
        root  /var/www/symfony/;
    }
}

server {
    listen      443           ssl http2;
    listen [::]:443           ssl http2;
    server_name               esgi.be;

    ssl                       on;
    ssl_certificate           /etc/letsencrypt/live/esgi.be/fullchain.pem;
    ssl_certificate_key       /etc/letsencrypt/live/esgi.be/privkey.pem;
    ssl_trusted_certificate   /etc/letsencrypt/live/esgi.be/chain.pem;

    access_log                /dev/stdout;
    error_log                 /dev/stderr info;

    root /var/www/symfony/public;

    location ^~ /build/ {
        alias /var/www/symfony/public/build/;
        gzip_static on;
        expires max;
        add_header Cache-Control public;
    }

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

    location ~ ^/index\.php(/|$) {
        include fastcgi.conf;
        fastcgi_pass php-upstream;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        internal;
    }

}

我该怎么做才能解决这个问题?

感谢您的帮助!

0 个答案:

没有答案