.htaccess for nginx enables nginx high performance webserver to deal with .htaccess
files.
.htaccess
files are mainly used for access control and URL rewrite instructions and are widely known across the web community. Originally designed for Apache, there is no native implementation available for nginx.
.htaccess for nginx is efficient and elegant, using micro caching and various performance tweaks right out of the box. It is effortless in its installation and usage. The plugin's deeply integrated approach is ideal for webhosters, who are looking for mixed technology solutions using only nginx and nothing else.
When using nginx, there are many legitimate reasons to support .htaccess
files.
.htaccess
files. January 2020, more than 24% of all active websites out there are still run by Apache's webserver, capable of utilizing .htaccess
files. If nginx had a way to support this feature, this number would be going down significantly, making the web faster..htaccess
files for nginx and fix all the errors, rant about unsupported or oddly mixed up auto-generated config goo coming from a random online converter..htaccess
file does just that..htaccess for nginx is incredibly lightweight and fast! It is writting from ground up with performance optimizations in mind. Even with low-end hardware it adds less than 1 millisecond to your response time, also for quite complex rewrite structures with server variables.
Physical memory usage of this plugin is insanely low, just less than 10 KB for each nginx worker process, and it doesn't increase with more requests.
nginx
with Lua modulecurl
command-line toolhtpasswd
utility (apache2-utils
package) for .htpasswd hashing functions (required for Basic HTTP Authentication)getent
utility (libc-bin
package) for hostname lookups (e.g. Deny from domainname.tld
)apt-get install nginx
apt-get install lua5.2
/etc/nginx/
, so that you can access /etc/nginx/htaccess-for-nginx/htaccess-x.x.x-bytecode.lua
http {}
context: lua_shared_dict htaccess 16m;
server {}
context): rewrite_by_lua_file /etc/nginx/htaccess-for-nginx/htaccess-x.x.x-bytecode.lua;
x.x.x
with the actual version number.lua_shared_dict
setting in http {}
, this plugin will refuse to work. It represents a caching system, used on a short-term per-request basis. Values (.htaccess
lines) are usually cached less than 100 milliseconds, but kept in memory as long as there are active connections. You can choose to assign any other memory amount to it, although 16 MB should be more than enough.http {}
context is technically possible. However, if you want to keep the good nginx performance for your new, non-legacy projects, you are highly encouraged to use this plugin in server {}
context only.include snippets/htaccess.conf
in the server {}
config.Create an .htaccess
file in a directory of your host with the following content:
Order deny,allow
Deny from all
When trying to access a file inside this directory through your browser, access should be denied by receiving an HTTP 403
response.
We compiled a complete list of implemented .htaccess
directives and variables.
This plugin tries to make things as secure as possible. Wherever an unclear situation occurs, access will be denied to prevent unintended access, e.g. if unsupported, security-critical directives are being used (HTTP 500 response). Unsupported, non-security-related directives will be ignored.
.htaccess for nginx plugin is now available for download. You can test it for free.
Download Test this plugin now, limited to 100 requests per server (re)start, without any subscription.
Get License Keep using .htaccess for nginx. First month free ❤ – Then only $9 USD per month, cancel anytime.
Read our Software License Agreement
Volume discounts available upon request, suitable for web hosters and data centers of any size.
Roadfamily LLC
412 N Main St 100
Buffalo, WY 82834
USA