0

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 ...
}
3
  • Is your fastcgi configured properly? Try location = /media/dir/test.php { } Commented Sep 26, 2013 at 12:16
  • As I have said, PHP executing in / is OK. And location you have told I already added (see config). Adding "=" does not affect anything. Commented Sep 26, 2013 at 13:56
  • 1
    where's your php block that executes / ? Commented Sep 26, 2013 at 18:52

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.