hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Hosting : htaccess / httpd.conf / Apache or Litespeed or Nginx - website performance?
Reply

Forum Jump

htaccess / httpd.conf / Apache or Litespeed or Nginx - website performance?

Reply Post New Thread In Web Hosting Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old
WHT Addict
 
Join Date: Jun 2010
Location: Where I feel like being.
Posts: 140
Question

htaccess / httpd.conf / Apache or Litespeed or Nginx - website performance?


This is really basic I guess but I read frequently that using .htaccess files is a real performance killer. But it looks like this is how the Apache webserver works!
When I read the following, I wonder how bad of an idea the concept is and especially on a shared server, where the look-up for this file throughout potentially multiple levels of directories would be further multiplied by the number of domains hosted!! ??

Quote:
If .htaccess files are allowed (through the AllowOverride directive) then apache will look for .htaccess files on every request. In addition apache has to look up the directory tree to see if there are further .htaccess files in locations above the location the file is requested from so that it can tell which directives have precedence. For example: if you request a file from /foo/bar, apache has to look for /foo/bar/.htaccess, /foo/.htaccess and /.htaccess and that’s even if there are no .htaccess files present in any of those locations! Once a .htaccess file is found it has to be parsed and don’t forget all of this has to happen for every request!!

As there’s nothing in a .htaccess file that can’t be achieved in your httpd.conf (or files included by httpd.conf) it makes sense to move existing .htaccess rules into your apache conf using a Directory or Location directive as appropriate.
So do I understand it correctly, that anything that would be put in one or multiple .htaccess files for a website could be put into one single file called httpd.conf, that sits on the Apache webserver itself? Yet, because my reseller hosting account is in a shared hosting environment, I can't access nor do I have the right to access or modify that file?

And even if I did not actually use a .htaccess file myself, the fact that everyone else might be, can still result in .htaccess file related performance issues?

I'm just asking to understand the concept and alternative solutions.
As far as I understand, by using Wordpress, it creates a .htaccess file at root level automatically. I actually added one line to prevent directory listing across the site/s (Options -Indexes). Does that mean this will already slow down my site/s? If adding more lines or multiple .htacess files in multiple directories means a slower site, doesn't that prove that the concept of using them (even if only once in the root) is a bad concept in itself?
Also, I think plugins like Yoast's Wordpress SEO requires a .htaccess file, but I am not sure.

Would all of this be resolved by moving to a VPS? Do I get my own Apache webserver and httpd.conf file there, or is this still under the limits of shared hosting in this regard?

Are there alternatives to what looks like another reason why it seems that Apache is not really helping with running fast performing websites/blogs?
I've heard of NGINX and LiteSpeed, but not sure how they compare to Apache regarding the need/performance/replacement of .htaccess files? How does a Wordpress site run on either, if a .htaccess file seems to be needed for WP?

EDIT: This is vital for me to understand, as I am looking for new reseller hosting and I am unsure what webserver technology would be the wisest to choose in a hosting provider. Down the track I may anticipate a VPS, but for now reseller hosting for my own sites should do.



Sponsored Links
  #2  
Old
Where Thought and Time Collide
 
Join Date: Apr 2011
Location: Toronto, ON
Posts: 5,389
A few points about WordPress;

1. WordPress creates a htaccess file depending on the folder permission

2. In order of Speed = Nginx, LiteSpeed, Apache

3. Nginx does not use htaccess...it has it's own rewrites equivelant to htaccess

4. WordPress can run without htaccess

Full Nginx (not Nginx in front of Apache) is very option, but does require some knowledge to understand it...BUT Apache and LiteSpeed can be configured to run as quickly as Nginx, but the main issue will be resources.

  #3  
Old
WHT Addict
 
Join Date: Jun 2010
Location: Where I feel like being.
Posts: 140
Thanks for that. Anyone else would like to add to that?
I would still like to know the impact of using 1 .htaccess file in the root of a site regarding the speed compared to not using a .htaccess file, at all. If WP can do without one, why does it create one automatically, pre-filled with some code as per below:

Quote:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Don't most plugins, incl. the Yoast WP SEO plugin not require a .htaccess file?

And still...is it true what's written in that quoted text in my OP?
Is it worthwhile choosing a VPS over reseller (shared) hosting on the fact alone, that a VPS gives me access to the httpd.conf file and that I can enter all directory related queries there, as opposed to the prospect of placing multiple .htaccess files into various directories?

It just sounds so inefficient when I read that Apache would be checking for a .htaccess file in each parent directory for each single page request...is THAT the web hosting standard..??

Sponsored Links
  #4  
Old
James Lee
 
Join Date: Oct 2007
Posts: 3,904
It all comes down to performance VS convenience.

It will be very inconvenient to modify the "httpd.conf" file for every domain name that you have, especially on a shared hosting environment as clients will not have access to this file. This is why major web servers (especially those meant for web hosting) like Apache and LiteSpeed utilizes ".htaccess".

Anyway the performance hit is not really big at all and will not change your website's loading speed if it is already loading smoothly currently. If your website is loading slowly, it is most likely caused by other stuffs which you should be more worried about.

__________________
Aspiration Hosting | Magento Hosting Solutions
Web Hosting Cloud Servers Content Delivery Network (CDN) Anycast DNS

NoFrillsReseller | Reseller Hosting + 24x7 Live Chat Support

  #5  
Old
Junior Guru Wannabe
 
Join Date: Feb 2013
Posts: 88
Quote:
Originally Posted by JLHC View Post
Anyway the performance hit is not really big at all and will not change your website's loading speed if it is already loading smoothly currently. If your website is loading slowly, it is most likely caused by other stuffs which you should be more worried about.
I think there's some disagreement as to how big the performance hit is for using .htaccess as opposed to httpd.conf with Apache. I know I've seen the number 40% somewhere (and it might have been on our website... I work for LiteSpeed) but I have no idea how that number is backed up. (Lies? Damned lies?) The explanation the OP pulled off the Apache site always seemed to make sense to me, but what do I know?

The important thing, though, is as James says: If your site(s) are doing fine now, don't worry about it.

(And, yes, if you moved to a VPS, you would get your own copy of Apache and, if you control and manage everything yourself, you could put all settings in httpd.conf. That would take a lot of effort, though.)


Last edited by lsmichael; 09-26-2013 at 12:37 PM. Reason: Make clear I work for LiteSpeed
  #6  
Old
Junior Guru Wannabe
 
Join Date: Feb 2013
Posts: 88
Quote:
Originally Posted by Robiro View Post
If adding more lines or multiple .htacess files in multiple directories means a slower site, doesn't that prove that the concept of using them (even if only once in the root) is a bad concept in itself?
Just to expand on something James said, yes, performance-wise .htaccess is a bad thing. But it's the best solution we've got for hosting a bunch of different users on one box and not allowing them all access to everyone else's configs. If you let everyone access httpd.conf and make their changes there, well, that could turn out bad. And if you tell everyone, "I don't want you slowing things down by using .htaccess files. Tell me the changes you want to make and I'll update the httpd.conf file for you because you don't have access to it." well, that would be bad for you.

Hope this clears things up.

m

  #7  
Old
WHT Addict
 
Join Date: Mar 2013
Location: North and South America
Posts: 165
There are so many ways to speed up web servers, websites and apache. Having really good components and a properly engineered and administered server will make website performance amazing. A few directives in an .htaccess files would do almost infinitesimally nothing to slow down a good box.

If you have a poorly performing webserver look to the real underlying reasons pages don't load fast. Horrible drives, improper setup, overstuffed boxes, lack of resources etc.

However, I do agree with the academic discussion!
1). If you are looking to milk every bit of speed and performance by all means take the extra trouble to move your directives to httpd.conf.
2). If you don't rely on underlying Apache technology and compatibility with required, Apache tied software that you really want go for Litespeed (I'm not really a fan of Nginx, but that is just my own preference). For the tradeoffs, loss of some Apps./Services and Cost, if you really want speed Litespeed is amazing.
3). While minimal directives in .htaccess are fine (for me due to administrative reasons) I do agree that there are often much smarter ways to implement all the tweaks and such I see in most .htaccess files. This does not always mean moving things to httpd.conf, for instance IP blocking is poorly administered via .htaccess, generally there are other ways to block and manage blocking such as via mod_security or at the network level.


Last edited by gPowerHost; 09-26-2013 at 01:27 PM. Reason: spelling
  #8  
Old
WHT Addict
 
Join Date: Mar 2013
Location: North and South America
Posts: 165
@Robiro just because WordPress can run without it doesn't mean that you are going to satisfy your WP customers by not allowing it. Just because one Plugin implements functionality (hopefully smartly so) without the need for .htaccess and another does says nothing about the need for the functionality itself.

Quote:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
This directive allows for the use of permalinks. WordPress heavily relies on URL rewriting.

Many WP Security Plugins rely on directives in .htaccess, and unless you have security staff to write better implementations on a server level (I do and highly recommend this) some already poorly maintained/written WP plugins present security threats, without which at least some additional security measures partially and quite effectively implemented via .htaccess clients sites will not only run a few MS slower they will be running much slower and serving additional hacker content. So there are good tradeoffs.

Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess -> httpd.conf problem deadsquirrel Programming Discussion 9 02-19-2012 07:36 AM
httpd.conf or .htaccess? Lordo Hosting Security and Technology 5 11-24-2004 04:38 PM
Apache performance w/ size of httpd.conf marksy Hosting Security and Technology 1 06-13-2004 06:23 PM
given up on .htaccess, trying httpd.conf MetalWyrm Hosting Security and Technology 2 05-04-2004 06:45 AM
editing the /apache/conf/httpd.conf in Cpanel by any user? Ironlung Web Hosting Lounge 0 11-09-2001 02:25 AM

Related posts from TheWhir.com
Title Type Date Posted
Microsoft Gains Most Websites in May Netcraft Web Server Survey Web Hosting News 2014-05-09 11:38:05
Nginx to be Included in Upcoming Ubuntu Release Web Hosting News 2014-01-08 15:17:12
Apache Market Share Dips Slightly in June Netcraft Web Server Survey Web Hosting News 2013-06-06 13:40:21
Apache Continues to Dominate Web Server Market in Netcraft May Survey Web Hosting News 2013-05-06 14:29:02
Apache Loses 9.9 Million Sites in Netcraft April 2013 Web Server Survey Web Hosting News 2013-04-03 14:42:33


Tags
htaccess, htaccess in wordpress, httpd.conf, litespeed, nginx

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
WHT Host Brief Email:

We respect your privacy. We will never sell, rent, or give away your address to any outside party, ever.

Advertisement:
Web Hosting News:
WHT Membership
WHT Membership



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?