• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Nginx disallowing execution of PHP in uploads directory with Magento

phpmagentonginxcentos


PHP Snippet 1:

## Location for media to prevent execution of php
location ^~ /media/              {}

PHP Snippet 2:

location ~ [^/]\.php(/|$) {

PHP Snippet 3:

location ~* /your_directory/.*\.php$ {
return 503;
}

PHP Snippet 4:

location /media/ {

   ......

   # Banned locations
    location ~* (\.php$|\.phtml$|\.htaccess$|\.git) {
        deny all;
    }
}

Related Snippets

Spam Filter in Contact Form

Jquery DataTables: Data not displaying in table via Ajax

How to pass data to all views in Laravel 5?

Inserting Country Selection into MySQL PHP [duplicate]

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

WHERE IN array binding in DB::raw laravel 5.4

Show Custom Data in Woocommerce Order Details Admin Area

Woocommerce redirect after add-to-cart error

Display a success custom notice after Placing an Order in WooCommerce

How to override header set in Apache config with more specific header in a virtual host

Custom Button next to “ADD TO CART” button of WooCommerce based on Product Type

how to redirect the user back to desired URL after login page in PHP?

Detect emoticons in string

renameColumn migration fails for existing column with columns does not exist error

How to make dot match newline characters using regular expressions

About Contact Privacy policy Terms and conditions