Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit31a13cb

Browse files
peterrehmweaverryan
authored andcommitted
Improved nginx config to not expose other php files
1 parentcf3ee37 commit31a13cb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎cookbook/configuration/web_server_configuration.rst‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ The **minimum configuration** to get your application running under Nginx is:
305305
# Remove the internal directive to allow URIs like this
306306
internal;
307307
}
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+
}
308314
309315
error_log /var/log/nginx/project_error.log;
310316
access_log /var/log/nginx/project_access.log;
@@ -318,10 +324,10 @@ The **minimum configuration** to get your application running under Nginx is:
318324
..tip::
319325

320326
This executes **only** ``app.php``, ``app_dev.php`` and ``config.php`` in
321-
the web directory. All other files will beserved as text. You **must**
322-
also makesure that if you *do* deploy ``app_dev.php`` or ``config.php``
323-
that thesefiles are secured and not available to any outside user (the
324-
IP addresschecking code at the top of each file does this by default).
327+
the web directory. All other files will bedenied. 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).
325331

326332
If you have other PHP files in your web directory that need to be executed,
327333
be sure to include them in the ``location`` block above.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp