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
-
Search Console Indexed Page Count vs Site:Search Operator page count
We launched a new site and Google Search Console is showing 39 pages have been indexed. When I perform a Site:myurl.com search I see over 100 pages that appear to be indexed. Which is correct and why is there a discrepancy? Also, Search Console Page Index count started at 39 pages on 5/21 and has not increased even though we have hundreds of pages to index. But I do see more results each week from Site:psglearning.com My site is https://wwww.psglearning.com
Technical SEO | | pdowling0 -
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 -
Schema markup for video vs. Authorship: How will the SERP look?
All, Would love to hear from the community on the issue of 2 rich snippets appearing on the same page, will one take precedence in the SERP? For example, I am working with a client who has authorship markup on his homepage, we are going to add to that schema markup for an introductory video. Will the video snippet or authorship snippet display? Will both display?
Technical SEO | | JSOC0 -
301s vs. rel=canonical for duplicate content across domains
Howdy mozzers, I just took on a telecommunications client who has spent the last few years acquiring smaller communications companies. When they took over these companies, they simply duplicated their site at all the old domains, resulting in a bunch of sites across the web with the exact same content. Obviously I'd like them all 301'd to their main site, but I'm getting push back. Am I OK to simply plug in rel=canonical tags across the duplicate sites? All the content is literally exactly the same. Thanks as always
Technical SEO | | jamesm5i0 -
What are the 5 most important things that a novice blogger can do to improve Moz Rank
I have been blogging for sometime now.Around 50 days to be specific. The best part is in these 50 days is I have been able to Monitor and improve my Alexa rank for above 19 million to below 400 thousand now and its still improving.More so,my country rank has improved quite drastically,its now among the first 20 thousand websites in India. However,I have noticed these things in particular - 1.Mozrank has been constant at 1.5, all this while. 2.The Root domain authority improved by just 1 point to 96,as I am using blogger platform. 3.The mozTrust has been 0 all this while too. I don't understand how to tackle these issues.As I am already featured in couple of websites among the top ranked blogs from India.I have kept my eye on the moz Rank now for quite sometime. Hence this obvious question.In my situation what are the 5 most important things a blogger can do to improve the ranking. I am targeting the bracket of 2-3 for the coming month ranking. Thank you beforehand. Much Regards Amit Ganguly Promote Green .. Promote Sustainability ..
Technical SEO | | amit.ganguly0 -
Different version of site for "users" who don't accept cookies considered cloaking?
Hi I've got a client with lots of content that is hidden behind a registration form - if you don't fill it out you can not proceed to the content. As a result it is not being indexed. No surprises there. They are only doing this because they feel it is the best way of capturing email addresses, rather than the fact that they need to "protect" the content. Currently users arriving on the site will be redirected to the form if they have not had a "this user is registered" cookie set previously. If the cookie is set then they aren't redirected and get to see the content. I am considering changing this logic to only redirecting users to the form if they accept cookies but haven't got the "this user is registered cookie". The idea being that search engines would then not be redirected and would index the full site, not the dead end form. From the clients perspective this would mean only very free non-registered visitors would "avoid" the form, yet search engines are arguably not being treated as a special case. So my question is: would this be considered cloaking/put the site at risk in any way? (They would prefer to not go down the First Click Free route as this will lower their email sign-ups.) Thank you!
Technical SEO | | TimBarlow0 -
Www vs non www and understanding opensite
Hi Guys, New guy here with some questions regarding the difference between www and non www. I am helping with a site at the moment and gradually working my way through bits and learning all the time. I was watching one of the seomoz videos and it brought my attention back to www vs non www. I understand that google will treat these as two seperate sites but wanted to check what the stats are telling me. I was under the impression that www.mydummysite.com was getting most links etc as this is what I have always used. However when I used Opensite explorer it told me something different as follows: www.mydummysite.com 32/100 29/100 5 16 mydummysite.com 32/100 29/100 2 1,500 Am i correct in saying that i should be adding a redirect from www.mydummysite.com to mydummysite.com ???? I am thinking that this is telling me that I am potentially missing out on 1,500 links to my site but it could mean I am missing out on just 16. Eitherway I guess its something I should fix right? Do I just redirect that page or would all pages beneith it such as mydummysite.com/news also need redirect??? Can i use Canonical Rel links for this now? Thanks for taking the time to read and reply! 🙂
Technical SEO | | wedmonds0