Nginx config with try_files and rewrite : precedence?
- by Penegal
Good morning, everybody.
Firstly, this question may have been already asked, but I searched ServerFault during about 15 minutes without finding it, so, if it was already asked, please accept my apologies.
I'm trying to rationalize my Nginx server config, but I have a rather dumb question that I couldn't solve, even with extensive Web search, except if I totally f*cked my search. Here is the question : is try_files parsed before or after rewrite ? Asked differently, Do I have to put try_files after all rewrite directives, or is Nginx config parser smart enough to evaluate try_files after all relevant rewrite directives ?
The link with the config rationalization is that the answer to this question will change the organisation of the config, ie if config file order of try_files and rewrite changes the config behaviour, it will force me to disperse my includes, some of them containing try_files and other ones containing rewrite, because I also have rewrite directly in nginx.conf.
Hoping you can help me,
Regards.