Nginx excluding directory from redirect rules -
i have following .conf in nginx
location / { if ($uri !~ ^/front/? ){ include ez_params.d/ez_rewrite_params last; } include common_auth.conf.inc; location ~ ^/(index|index_(rest|cluster|treemenu_tags))\.php(/|$) { #bunch of rules here } }
what trying here here excluding /front/ folder ezpublish rewrite rules. however, not not work, gives me error while trying load file:
"nginx: [emerg] "include" directive not allowed here in /etc/nginx/conf.d/staging-preview.conf:51 nginx: configuration file /etc/nginx/nginx.conf test failed"
i found out using "if" pretty not done, see http://wiki.nginx.org/ifisevil , don't understand should instead.
just create individual location blocks , include/exclude whatever want. can repeat "includes" in each needed
for example:
location ~ ^/front/? { # here include common_auth file include common_auth.conf.inc; } location ~ ^/(index|index_(rest|cluster|treemenu_tags))\.php(/|$) { # here include common_auth file include common_auth.conf.inc; .... } location / { # here include common_auth file # ez_rewrite_params include ez_params.d/ez_rewrite_params; include common_auth.conf.inc; }
note don't use "last" including files
Comments
Post a Comment