I've been working with Apache http servers for quite some time, and finally making the move to static-content servers alongside the others dynamic-content machines.
I was wondering, does nginx support ".htaccess" files, and things like mod_rewrite?
As I'm very used to the syntax, I was wondering what the (syntax) differences were, and what the learning curve is like moving from Apache configs to nginx.
nginx rewrite syntax is much cleaner then the counterpart in mod_rewrite:
mod_rewrite rule:
Becomes in nginx:
But no .htaccess support...
Edit: Another example how to support http://example.com/~username/ urls in nginx:
It would appear that nginx does have a mod_rewrite equivelent and documentation can be found here. I've not used nginx myself, but the documentation looks like the configuration is totally different, but it shouldn't be too hard to understand what it's doing. The wiki appears to have plenty of examples.
I can't answer if you can have per directory configuration files like you can with apache. It wouldn't surprise me if you could, because people have come to expect that from using apache.
nginx does provide rewrite functionality, check NginxHttpRewriteModule
What do you want to do with .htaccess? You can setup nginx for Basic Authentication with NginxHttpAuthBasicModule but AFAIK configuration directives can only be stored in nginx.conf
NGINX DOES support having configurations in many files through the 'include' directive. Basically, it loads a sub-configuration and put it in place. It also supports joker characters, so it's easy to load many of them in one shot.
The only limitation (in my opinion) is that you need to reload when the configuration is changed. So any user who has a piece of configuration might need rights to reload nginx config:
/etc/ini.d/nginx force-reload (on centos)
I don't really know if there is a way to avoid that or to do it differently because I use NGINX on many servers with lots of apps(virtual hosts) which are my own. It would mean that NGINX is not ideal on shared hosting.
Nevertheless I really love NGINX because configuration is just so much more legible than a nasty XML file. Question of taste I guess. The other good point is obviously speed, if it's important in your case.
Good luck mig