0

This is my nginx conf:

server {
    root /var/www/html/public;

    location / {
        rewrite ^(.*)$ /index.php last;
        try_files $uri $uri/ /index.php?$query_string =404;
    }

    location = /path/file.php {
        root /var/www/html;
        try_files $uri $uri?$query_string =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
}

The first part is working fine and all URLs are being redirected to /public/index.php. However, I'm not being able to allow access to /path/file.php. With the current configuration, it downloads the file instead of interpreting it. I've been playing around but with the other options I've tried, the request gets handled by /public/index.php.

How can I allow access to this particular file outside the root?

Gerardo
  • 111
  • 3

0 Answers0