NGINX is serving me php files instead of executing them
This is all you need:
location / {try_files $uri @rewrite;}location @rewrite {if ($uri !~* "^/(cms-system\/public|assets)$") {set $block "A";}if (!-e $request_filename) {set $block "${block}B";}if ($block = "AB") {rewrite ^(.*)$ /cms-system/public/$1 last;}}
instead of:
RewriteEngine OnRewriteCond %{REQUEST_URI} !(^cms-system/public|^assets)RewriteCond %{SCRIPT_FILENAME} !-fRewriteCond %{SCRIPT_FILENAME} !-dRewriteRule ^(.*)$ cms-system/public/$1 [L]
This is recommended for security reasons:
location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {deny all;}
Read also:
porting-standard-apaches-mod_rewrite-rules-to-nginx
How do I convert mod_rewrite (QSA option) to Nginx equivalent?