Nginx Rewrite Fails

Discussion in 'ISPConfig 3 Priority Support' started by LinuxPete, Jul 31, 2013.

  1. LinuxPete

    LinuxPete Member HowtoForge Supporter

    Hi,
    I'm trying to use the Nginx directive snippet of Isconfig3 to hide a directory by entering the following code:

    location ~ /(private|lib) {
    deny all;
    return 403;
    }

    However, as a test when I try to access a file from that dir with (for example) example.com/private/somefile.php , I get a blank screen (which is correct as it is a php file w/o html) but not an error in the error log. I do not get a 403 forbidden from Nginx which makes me think the directive is not working.

    Am I missing something?

    I'm using Ispconfig3 on Centos 6.4 (Final).
    Thanks for any help.
    Ray
     
  2. falko

    falko Super Moderator ISPConfig Developer

    I think the problem is that it is a PHP file, so that the PHP location matches instead of this location.

    Can you try this?

    Code:
    location ~ /(private|lib) {
      deny all;
      return 403;
      location ~ \.php$ {
        deny all;
        return 403;
      }
    }
     
  3. LinuxPete

    LinuxPete Member HowtoForge Supporter

    Thanks, that's just what it was.
     

Share This Page