-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added moodle.conf nginx configuration file to avoid some direct files (…
…#75)
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# This passes 404 pages to Moodle so they can be themed | ||
error_page 404 /error/index.php; | ||
error_page 403 =404 /error/index.php; | ||
|
||
# Dedicated block to override error_page for any /fixtures/ requests | ||
location ~ /fixtures/ { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
|
||
# TODO: Temporary block exact match for /privacy/tests/fixtures/logo.png (see issue #74) | ||
location = /privacy/tests/fixtures/logo.png { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
# TODO: Temporary block exact match for /enrol/lti/tests/fixtures/input.xml (see issue #74) | ||
location = /enrol/lti/tests/fixtures/input.xml { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
# Block exact match for /admin/environment.xml | ||
location = /admin/environment.xml { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
# Block exact match for /lib/db/install.xml | ||
location = /lib/db/install.xml { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
# Block exact match for /mod/assign/db/install.xml | ||
location = /mod/assign/db/install.xml { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
# Hide all dot files but allow "Well-Known URIs" as per RFC 5785 | ||
location ~ /\.(?!well-known).* { | ||
return 404; | ||
} | ||
|
||
# This should be after the php fpm rule and very close to the last nginx ruleset. | ||
# Don't allow direct access to various internal files. See MDL-69333 | ||
location ~ (/vendor/|/node_modules/|composer\.json|/readme|/README|readme\.txt|README\.txt|upgrade\.txt|UPGRADING\.md|UPGRADING\-CURRENT\.md|db/install\.xml|/fixtures/|/behat/|phpunit\.xml|\.lock|environment\.xml|doesnotexist|CHANGELOG|CHANGELOG\.md|TRADEMARK\.txt|PULL_REQUEST_TEMPLATE\.txt|INSTALL\.txt|CONTRIBUTING\.txt|behat\.yml\.dist|phpunit\.xml\.dist|package\.json|npm-shrinkwrap\.json|security\.txt|index\.php\.inc) { | ||
deny all; | ||
return 404; | ||
} | ||
|
||
# Offload file serving from PHP process as per Moodle documentation | ||
location ~ ^/dataroot/(.*)$ { | ||
internal; | ||
alias /var/www/moodledata/$1; | ||
} | ||
|