Skip to content

Commit 8ce7be4

Browse files
committed
minor #12125 add FallbackResource alternative for assets/bundles in nginx (fliespl)
This PR was submitted for the master branch but it was merged into the 4.3 branch instead (closes #12125). Discussion ---------- add FallbackResource alternative for assets/bundles in nginx As described above - this location rule provides similar functionality to apache FallbackResource example. Commits ------- 8958f6c add FallbackResource alternative for assets/bundles in nginx
2 parents bfcccc3 + 8958f6c commit 8ce7be4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

setup/web_server_configuration.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,13 @@ The **minimum configuration** to get your application running under Nginx is:
294294
# try to serve file directly, fallback to index.php
295295
try_files $uri /index.php$is_args$args;
296296
}
297+
298+
# optionally disable falling back to php script for the asset directories
299+
# which will allow nginx to return a 404 error when files are
300+
# not found instead of passing the request to Symfony
301+
location /bundles {
302+
try_files $uri $uri/ =404;
303+
}
297304
298305
location ~ ^/index\.php(/|$) {
299306
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

0 commit comments

Comments
 (0)