June 14, 2016 in Classic self-hosted technical help
Many users are using .htaccess files with some rules inside and they try to get high performance.
Others are trying to adjust .htaccess files on Nginx web servers...
Well .htaccess is killing your performance what ever rules are you using and Nginx is NOT read that files at all !
.htaccess to work Apache needs to check EVERY directory in the requested path for the existence of a .htaccess file and if it exists it reads EVERY one of them and parses it. This happens for EVERY request. Remember that the second you change that file, it’s effective. This is because Apache reads it every time.
Let’s say we’re not doing any funky aliasing and the file system looks like the path. This covers most of the sites out there. There is the / directory, then site/, files/, images/, and layout/. This amounts to 5 directories that could have a .htaccess file. Let’s say you added a .htaccess in /, files/ and images/. That’s three .htaccess files. That’s pretty typical.
Now the numbers, that’s 6 file system stats and 4 file system reads. Including one for the requested file. This happens for every read. We’ll ignore parsing time because both NGINX and Apache need to do this and we’ll consider the difference in time for this negligible.
The default for Apache is to use AllowOverride All. Let’s look at this for a Drupal website. One image for the theme. If you’re website DocRoot is at /var/www/drupal6/ then we just added more file system stats. This adds 3 stats per request. This is an incredibly common Apache/Drupal setup. It’s the end result of countless guides out there.
Two .htaccess files will be in this path unless you create your own. I’ll be assuming you added one in /var/www/ because this is common.
Stop using .htaccess. It’s horrible for performance. NGINX is designed to be efficient.
This topic is now archived and is closed to further replies.
Started Friday at 07:29 AM
Started September 8
Started September 4