Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Mistakes in the php {} part of vhost configuration files make php files to be "readable" with its source code like text files

Is there a global setting, e.g. in the default config to forbid accessing php files without fastcgi?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You could just use:

 location ~ \.php$ {
    deny all;
 }

in case you want to make php files to be not accessible server wide or:

 location ~ /path/to/dir/(.+)\.php$ {
    deny all;
 }

For a specific location.

share|improve this answer
    
This overwrites the other location php section (or is ignored). –  ledy Jun 21 '12 at 7:06
    
This is the normal thing to do if you want to ignore php files. In order to know more, the full config needs to be present so to check all the aspects. –  Logic Wreck Jun 21 '12 at 10:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.