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
-
Are "appliance repair" and "appliance repair los angeles" consider the same keyword?
Hello, I know that you can't optimize two pages for 1 keyword because Google will get confused and will rather prefer my competitor. But I can't get if it will consider "appliance repair" and "appliance repair los angeles" same keywords? The homepage of my website, https://www.ifixappliancesla.com, is optimized for "appliance repair", one of the inner pages is optimized for "appliance repair los angeles". None of them shows on the first page in local SERPs for any of those quires. I am wondering if this is because Google sees it as both pages are optimized for "appliance repair"?
Technical SEO | | VELV0 -
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 -
YouTube vs. LimeLight - What are the SEO pros and cons of each platform for on-site video viewing?
Are there any SEO benefits of hosting on-site videos using LimeLight? I know the various benefits of using YouTube but before going forward with a site redesign I want to hear what others have to say. Thanks, Jake
Technical SEO | | JakeMatulewicz1 -
Direct link vs 302 redirect
So we have recently relaunched a site that we manage. As part of this we have changed the domain. The webdesign agency that built the new site have implemented a direct link from the old domain to the new domain. What is best practice a direct link or a 302 redirect? Thanks
Technical SEO | | cbarron0 -
XXXXX21ZZZZZZ.com VS X21Z.com which is a better domain?
We are launching a new eCommerce business selling hair extensions, wigs and hair loss prevention products. Our business name will be LXXks21 Zorever, what will be a better domain name to use lXXks21foZZZer.com or the shorter 4 character domain name X**21Z.com **? Thanks in advance for taking the time to reply.
Technical SEO | | SiddhartJain0 -
Main vs Pointing URL Confusion
Hi, I have a new website that deals with 3 very similar businesses The main purpose of the website is to assist the consumer to search, compare and book chaffered transportation online. The 3 businesses are taxi cab hire, limo hire, party bus hire. My main domain is www.mytaxicab.co.za. I also own the domains mylimo.co.za and mypartybus.co.za. My question is, from a best practice SEO perspective, how should I set this up. Should I have one main site www.mytaxicab.co.za and have the 2 other niche domain names point in eg user types www.mypartybus.co.za and lands on www.mytaxicab.co.za/party-bus-hire or is there a better way? Any help or insite would be appreciated
Technical SEO | | chirsirwin0 -
Syndication: Link back vs. Rel Canonical
For content syndication, let's say I have the choice of (1) a link back or (2) a cross domain rel canonical to the original page, which one would you choose and why? (I'm trying to pick the best option to save dev time!) I'm also curious to know what would be the difference in SERPs between the link back & the canonical solution for the original publisher and for sydication partners? (I would prefer not having the syndication partners disappeared entirely from SERPs, I just want to make sure I'm first!) A side question: What's the difference in real life between the Google source attribution tag & the cross domain rel canonical tag? Thanks! PS: Don't know if it helps but note that we can syndicate 1 article to multiple syndication partners (It would't be impossible to see 1 article syndicated to 50 partners)
Technical SEO | | raywatson0 -
Panda Update Question - Syndicated Content Vs Copied Content
Hi all, I have a question on copied content and syndicated content - Obviously copying content directly form another website is a big no no, but wanted to know how Google views syndicated content and if it views this differently? If you have syndicated content on your website, can you penalised from the lastest Panda update and is there a viable solutiion to address this? Mnay thanks Simon
Technical SEO | | simonsw0