Skip to content

Instantly share code, notes, and snippets.

@barryvdh
Last active August 4, 2017 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save barryvdh/8f189c0145f69f76b77a99e579973d98 to your computer and use it in GitHub Desktop.
Save barryvdh/8f189c0145f69f76b77a99e579973d98 to your computer and use it in GitHub Desktop.
Disable PHP execution
# Turn off all options we don't need.
Options None
Options +FollowSymLinks
# Set the catch-all handler to prevent scripts from being executed.
SetHandler Security_Do_Not_Remove_This_Line
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Security_Do_Not_Remove_This_Line
</Files>
# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
location ^~ /storage/ {
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
# Prevent php files from being accessible in this location
location ~ \.php$ {
return 403;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment