Nginx vs. Apache, All Things Considered
-
Hey Peeps,
I've been struggling lately with a new static site, and I'm looking for anyone's opinion who's had to optimize a site using Nginx. I understand that Nginx is recommended for static sites, however I want to avoid being in a situation where I can't do things like write redirect rules the way I want to.
Considering that it will be hosting a Static site, are there any features or functions that Nginx lacks when compared to Apache, such as ability to write rewrite rules, etc.?
-
Great to hear. Let me know if you have any question when you start that project.
Casey
-
Yup, I'm in the same boat as you, I'd much rather do server-side redirects..
As an update on this "project", we used the pageless redirects in our staging environment on S3 just now, but were unsuccessful. Certain redirects that we set up in pageless redirects, (such as adding a trailing slash to URLs without,) got clobbered by S3's default setting of 302ing to adding a trailing slash. Weak sauce, Amazon!
At this point, we're going with Apache, since it's the App that our developers know best and we've had too many problems to experiment with our live environment. This being said, our next project after we relaunch with proper redirects will be to begin testing on our stage with Nginx
Thanks for your input!
-
Hey Danny,
I've always done 301 redirects from the server and avoided any other method. This was more for my sanity to make sure that I was getting all the equity I could if there was a difference, not saying there is a difference but if there way, I wanted to be safe. Since it sounds like you may be constrained by your technology, the solution you are going with is fine but if you had both options available, I'd go with the server side redirect always.
-
Thanks Casey!
We've actually found a different work-around that we are looking at right now, using the "pageless redirects" plugin for Jekyll. Basically it uses the meta refresh + rel canon redirection method that Matt Cutts got called out on a while ago. This would allow us to stay on S3 and maintain our blazing fast site speed.
Through my research so far, this seems to pass equity in much the same way as a Server App 301.. Have you had any experiences/heard anything to the contrary?
-
Hi Danny,
The Moz.com website/blog are running on PHP/Nginx. As Matthew said, Nginx is much faster and less intensive on the servers for both CPU and memory. Nginx has some great documentation and is really easy to get things to redirect. It's as easy as adding lines like the following to your configuration and your good to go:
rewrite ^/q$ /community/q permanent;
rewrite ^/q/(.*)$ /community/q/$1 permanent;Making the switch from Apache to Nginx was one of the best things we ever did and I would highly suggest you do the same thing for both static and any dynamic sites you may have. I'll most likely never use Apache again.
Casey
-
From the little I know of Nginx, I know it is meant to be faster, less intensive on server memory and able to handle more concurrent connections, but Apache is more widely supported across different servers and is more flexible out of the box.
The one thing I have had to get my head around in working on clients sites that run on Nginx is the different URL rewrite rules i.e. http://nginx.org/en/docs/http/converting_rewrite_rules.html
-
Thanks Jeff!
I think we're going to go with Apache for now, since it's what all of us are well-versed in. We'll probably be switching to Nginx at some point in the future, and focusing on other aspects that you mentioned, such as caching and compression, in the meantime.
Cheers.
-
Danny - We use Nginx on our WordPress site, and it's pretty quick and easy. We're able to use the same .htaccess rules to handle rewrites, and for the most part, there's very little downside. You do want to make sure that your site isn't going to break before you launch it on Nginx, so I'd test it with a test URL first before you push it live.
We're also running Varnish as a caching system, and our page load speed takes the page from a slowwww load time to a really fast 1.5 second load time.
Hope this helps...
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
How to arrange taxonomies when many mean the same thing?
Hello 🙂 I'm trying to figure out the category/taxonomy structure for my website which will be selling "Colored Contact Lenses" I'm a bit confused because, there are several search queries which sort of mean the same thing, for example "Halloween Contacts" are sort of the same thing as "Colored Contacts" people searching for Colored Contacts may potentially be looking for "Natural" styles, however many are looking for crazy styles, aka "Halloween Contacts" or "Crazy Contacts" Crazy contacts and halloween contacts, being the exact same thing just different choice of words from the searcher. So I'm trying to think of what to do for categories/link structure... I believe i should start with a primary category .com/colored-contacts/ then .com/colored-contacts/halloween-contacts/ But what about crazy contacts? Should I keep going, .com/colored-contacts/crazy-contacts/ which will have the exact same products listed? I'm kind if going crazy thinking about this lol, any thoughts and advice would be highly appreciated. Thank you!
Technical SEO | | abuntlysupport0 -
Are image pages considered 'thin' content pages?
I am currently doing a site audit. The total number of pages on the website are around 400... 187 of them are image pages and coming up as 'zero' word count in Screaming Frog report. I needed to know if they will be considered 'thin' content by search engines? Should I include them as an issue? An answer would be most appreciated.
Technical SEO | | MTalhaImtiaz0 -
Which is better Title length vs. keywords?
We run a jobboard. The title tag on a page for a job is often over 70 characters. An example of one would be: " Supplier Quality Inspector (Electrical Manufacturing) Job in Orlando, FL 32809 at Pro Image Solutions | Orlando Jobs!" The company name 'Orlando Jobs!" comes at the end but is also a really good keyword e.g. 'Orlando' and 'Jobs' I am interested in suggestions as to how to make these titles better. For example take off the company name when we go over 70 characters? Move the company name to the front of the title because the company name is also good keywords? I am looking for the best way to handle the issue is all. Thanks.
Technical SEO | | JobBiz0 -
SEOMoz Crawler vs Googlebot Question
I read somewhere that SEOMoz’s crawler marks a page in its Crawl Diagnostics as duplicate content if it doesn’t have more than 5% unique content.(I can’t find that statistic anywhere on SEOMoz to confirm though). We are an eCommerce site, so many of our pages share the same sidebar, header, and footer links. The pages flagged by SEOMoz as duplicates have these same links, but they have unique URLs and category names. Because they’re not actual duplicates of each other, canonical tags aren’t the answer. Also because inventory might automatically come back in stock, we can’t use 301 redirects on these “duplicate” pages. It seems like it’s the sidebar, header, and footer links that are what’s causing these pages to be flagged as duplicates. Does the SEOMoz crawler mimic the way Googlebot works? Also, is Googlebot smart enough not to count the sidebar and header/footer links when looking for duplicate content?
Technical SEO | | ElDude0 -
Is adding reviews to your site using schema structured data markup considered duplicating content?
A client of mine whats to add reviews from other sites such as Judys Book and Yahoo to their site. (Yes the actual content of what was posted in the review. They are proud of what their clients are saying). I am not sure if using schema mark up and including the review body on the clients web site was safe or would it be considered duplicate content? Is there a "good practice" for this? Any assistance or suggestions are welcomed. Thanks!
Technical SEO | | mgordon0 -
Url rewrites / shortcuts - Are they considered duplicate content?
When creating a url rewrite or shortcut, does this create duplicate content issues? split your rankings / authority with google/search engines? Scenario 1 wwwlwhatthehellisahoneybooboo.com/dqotd/ -> www.whatthehellisahoneybooboo.com/08/12/2012/deep-questions-of-the-day.html Scenario 2 bitly.com/hbb -> www.whatthehellisahoneybooboo.com/08/12/2012/deep-questions-of-the-day.html (or to make it more compicated...directs to the above mentioned scenario 1 url rewrite) www.whatthehellisahoneybooboo.com/dqotd/ *note well- there's no server side access so mentions of optimizing .htacess are useless in this situation. To be clear, I'm only referring to rewrites, not redirects...just trying to understand the implications of rewrites. Thanks!
Technical SEO | | seosquared0 -
Http:// vs http://www.
Why is it that when I run an "On Page Optimization Keyword Report" for my website I get a different score when using http://www.tandmkitchens.com vs http://tandmkitchens.com. My keyword is "Kitchen Remodeling" http://www.tandmkitchens.com scores an A http://tandmkitchens.com scores a B It's the same page yet one url scores higher than the other. Any help! Thanks
Technical SEO | | fun52dig
Gary0 -
Is use of javascript to simplify information architecture considered cloaking?
We are considering using javascript to format URLs to simplify the navigation of the googlebot through our site, whilst presenting a larger number of links for the user to ensure content is accessible and easy to navigate from all parts of the site. In other words, the user will see all internal links, but the search engine will see only those links that form our information hierarchy. We are therefore showing the search engine different content to the user only in so far as the search engine will have a more hierarchical information architecture by virture of the fact that there will be fewer links visible to the search engine to ensure that our content is well structured and discoverable. Would this be considered cloaking by google and would we be penalised?
Technical SEO | | JohnHillman0