We've recently discovered that certain scripts (if you know the path) can be executed directly from outside the website. (ideally the only way to execute a script should be by ssh
-ing into the server or by setting a cron
(or application features)
exmple.com/scripts_directory/script_sub_dir_1/script_1_name.php
Similarly we've discovered that a lot of images and videos can be accessed directly from outside the website, directly from the media file's path.
exmple.com/media_directory/media_sub_directory/media_file.mp4
Ideally the users of the website are supposed to be logging in to view any of the content since it is copyrighted, and to be paid for.
What can we do to:
- protect our site from scripts being executed from the url
- protect media files from being accessed (if the user is not logged in/outside the application).
These are some of the links I'm looking at: https://webmasters.stackexchange.com/questions/84615/protecting-video-being-from-downloaded Prevent direct access to a php include file
We have an nginx server using php 5.6.
Update:
The following locations are not accessible.
exmple.com/scripts_directory/script_sub_dir_1/
exmple.com/media_directory/media_sub_directory/
exmple.com/scripts_directory/
exmple.com/media_directory/