James Joomer
James Joomer

Reputation: 41

Executing PHP in files folder, Nginx

I have a Joomla installed and need to allow users run one PHP file from /media folder. How to do it?

With current config, Nginx returnes this PHP as file for download, without executing it. Here is a part of my config:

location ~* /media {
   allow all;
   expires      1d;
}

location /media/dir/test.php {
   fastcgi_pass   unix:/var/run/php5-fpm.sock;
   include fastcgi_params;
   fastcgi_param       SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}

location / {
   #PHP here works fine
   try_files $uri $uri/ /index.php?$args;
   # .. skipped ...
}

Upvotes: 0

Views: 808

Answers (1)

James Joomer
James Joomer

Reputation: 41

I have understood where the problem is. I was need in swap "location ~* /media" block with "location /media/dir/test.php" blocks in the file to have right priority.

Upvotes: 1

Related Questions