I have a server (nginx/1.6.0 PHP 5.5.14) with these settings that works correctly. The problem is when I use the location ^~ /sys/
When I try to access the sys folder it downloads the index. If I remove location ^~ / sys /
back to working normally. he error only happens with php files. html files works normally. Where is the error?
server {
server_name site.com;
root /home/www/site.com;
index index.php index.html index.htm;
location / {
index index.php index.html;
try_files $uri $uri/ /index.php;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/data/php5514/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 300;
include fastcgi_params;
}
location ^~ /sys/ {
}
}
I'm using a script and need to do this setup in nginx to protect a folder from unauthorized access.
location ^~ /FOLDER/ {
if ($cookie_amember_nr !~* [a-zA-Z0-9]+) { #not authorized
rewrite ^(.*)$ http://EXAMPLE.COM/AMEMBER/protect/new-rewrite?f=FOLDERID&url=$request_uri?$args redirect;
}
set $file $document_root/AMEMBER/data/new-rewrite/$cookie_amember_nr-FOLDERID;
if (!-f $file) { #have not access
rewrite ^(.*)$ http://EXAMPLE.COM/AMEMBER/no-access/folder/id/FOLDERID?url=$request_uri?$args redirect;
}
#everything is ok
}
But this problem with location ^ ~
does not work.