I need a special directory override of NGINX rules on my web server so that the rules that apply to /var/www/acme regarding CSS, JS, etc. do not apply to /var/www/acme/special. I have a /var/www containing my website under me.com (127.0.0.1 localhost setup). Inside there, I have an acme folder that uses a special framework for my PHP. However, I have a folder /var/www/acme/special that needs to not apply those same rules and just run like a regular PHP website. I'm stuck because when I apply the logic with a special location and try_files routine, along with a break, for /var/www/acme/special, then I get an HTTP 500 error that says "rewrite or internal redirection cycle when internally redirecting to '/acme/special////////////".
Here's my /etc/nginx/sites-available/me.com file for NGINX on Ubuntu 16.04. What am I doing wrong?
server {
listen 80;
listen [::]:80;
root /var/www;
index index.php index.html;
server_name me.com www.me.com;
location /acme/special {
try_files $uri $uri/;
break;
}
location ~ ^/acme/(.*(?<!boot))/css/(.*)$ {
alias /var/www/acme/$1/views/assets/css/$2;
}
location ~ ^/acme/(.*(?<!boot))/js/(.*)$ {
alias /var/www/acme/$1/views/assets/js/$2;
}
location ~ ^/acme/(.*(?<!boot))/img/(.*)$ {
alias /var/www/acme/$1/views/assets/img/$2;
}
location ~ ^/acme/(.*)/fonts/(.*(?<!boot))$ {
alias /var/www/acme/$1/views/assets/fonts/$2;
}
location ~ ^/acme/(.*)/boot/(.*)$ {
alias /var/www/acme/$1/views/assets/boot/$2;
}
location / {
try_files $uri $uri/ @php;
}
location @php {
rewrite ^/acme/([^\/]+)/.*((?!index\.php).)*$ /acme/$1/index.php?query_string last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}