• 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

How to install php yaml on CentOs?

PHP file_get_contents function

How do I pass the dynamic output of a php variable or php function to a CSS variable?

Laravel Schedule not sending email

SQL to convert multiple rows into a single row of variable length

Destroy session upon refresh

Laravel 8 Multiple Relationships for Factory

Unable to guess the mime type as no guessers are available Laravel 5.2

PHP: How to raise number to (tiny) fractional exponent?

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Symfony there are no commands defined in the "make" namespace

Add custom text under order details on WooCommerce My account view order pages

Change the alert text on add to cart action without selected variation in Woocommerce

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

Detect if PHP session exists

About Contact Privacy policy Terms and conditions