File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,12 @@ The **minimum configuration** to get your application running under Nginx is:
305
305
# Remove the internal directive to allow URIs like this
306
306
internal;
307
307
}
308
+
309
+ # return 404 for all other php files not matching the front controller
310
+ # this prevents access to other php files you don't want to be accessible.
311
+ location ~ \.php$ {
312
+ return 404;
313
+ }
308
314
309
315
error_log /var/log/nginx/project_error.log;
310
316
access_log /var/log/nginx/project_access.log;
@@ -318,10 +324,10 @@ The **minimum configuration** to get your application running under Nginx is:
318
324
.. tip ::
319
325
320
326
This executes **only ** ``app.php ``, ``app_dev.php `` and ``config.php `` in
321
- the web directory. All other files will be served as text . You **must **
322
- also make sure that if you *do * deploy ``app_dev.php `` or ``config.php ``
323
- that these files are secured and not available to any outside user (the
324
- IP address checking code at the top of each file does this by default).
327
+ the web directory. All other files will be denied . You **must ** also make
328
+ sure that if you *do * deploy ``app_dev.php `` or ``config.php `` that these
329
+ files are secured and not available to any outside user (the IP address
330
+ checking code at the top of each file does this by default).
325
331
326
332
If you have other PHP files in your web directory that need to be executed,
327
333
be sure to include them in the ``location `` block above.
You can’t perform that action at this time.
0 commit comments