Page Discussion History


Revision as of 15:29, 22 March 2010 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Why no .htaccess?

There will likely never be a .htaccess-like functionality for Nginx. The reasoning is this:

1) .htaccess is highly inefficient. If you enable .htaccess on Apache, this means that every time Apache serves a file or directory, it must check that directory and every directory above it to see if there are any changes to .htaccess in those directories.

2) .htaccess solves a problem for Apache that Nginx simply does not have. Apache consumes a large amount of RAM. This makes it impractical to run multiple instances of Apache on the same server, especially not dozens or hundreds of instances. Therefore you must have a single, monolithic instance of Apache that serves everyone and you must therefore have a way for users to modify that instance without changing httpd.conf. With Nginx you can simply run an instance of Nginx per user and proxy to them from the main Nginx instance. This is far more powerful and efficient. It is also far more secure since each instance runs as the user, with the users permissions, and has no way of affecting other users.

3) While .htaccess might make it structurally simpler to migrate some apps from Apache (the files could be located in the same place), the differences are already deep enough that I doubt this would make much difference at all (Nginx would have to support Apache configuration syntax in order to use existing .htacess files).