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
-
Backlink quality vs quantity: Should I keep spammy backlinks?
Regarding backlinks, I'm wondering which is more advantageous for domain authority and Google reputation: Option 1: More backlinks including a lot of spammy links Option 2: Fewer backlinks but only reliable, non-spam links I've researched this topic around the web a bit and understand that the answer is somewhere in the middle, but given my site's specific backlink volume, the answer might lean one way or the other. For context, my site has a spam score of 2%, and when I did a quick backlink audit, roughly 20% are ones I want to disavow. However, I don't want to eliminate so many backlinks that my DA goes down. As always, we are working to build quality backlinks, but I'm interested in whether eliminating 20% of backlinks will hurt my DA. Thank you!
Technical SEO | | LianaLewis1 -
301 vs 500 Errors for discontinued products
I have a client that has a around 15 "products" (they are pages containing details of the products rather than e-Commerce products) that have been discontinued. The client has suggested 301s but unless the alternative products are replacement products am I correct that we should be using a 500 error?
Technical SEO | | MentorDigital0 -
Can anyone speak to the pros and cons of installing mod_expire on an Apache server?
We recently had mod_deflate and mod_expire installed on our server in an attempt to improve pagespeed. They worked beautifully, at least we thought they did. Google's pagespeed insights tools evaluated our homepage at 65 before the install and 90 after...major improvement. However, we seem to be experiencing very slow load on our product pages. There is a feeling (not based on any quantifiable data) that mod_expire is actually slowing down our page load, particularly for visitors who do not have the page cached (which would probably be most visitors). Here are some pages to look at with their corresponding score from the Pagespeed Insights tool: Live Sound - 91 http://www.ccisolutions.com/StoreFront/category/live-sound-live-audioWireless Microphones - 90 http://www.ccisolutions.com/StoreFront/category/microphones Truss and Rigging - 79 http://www.ccisolutions.com/StoreFront/category/lighting-truss light weight product detail page 83 http://www.ccisolutions.com/StoreFront/product/global-truss-sq-4109-12-truss-segment heavy weight product detail page 77 http://www.ccisolutions.com/StoreFront/product/presonus-studiolive-16-4-2 Any thoughts from my fellow Mozzers would be greatly appreciated!
Technical SEO | | danatanseo1 -
Different domains vs subdomains for 6 e-shops
We have to choose to stay working with different domain or move all 6 domains to new domain. Right now we have 6 different brand e-shops with 6 domains that have Domain Authority 30-40. So for example:
Technical SEO | | TauriUrb
e-shop1.com
e-shop2.com
.. And we are thinkig about making brand new domain and move all these domains content and link juice into one domain with 301 redirect. So we would have one e-shop solution with 6 subdomains like: e-shop1.newdomain.com
e-shop2.newdomain.com
... Like gap.com does with their brands or http://www.andotherbrands.com. That each brand has subdomains but they use same e-shop solution. With same domains or new subdomains strategy, we will improve internal linking structure between all these e-shops. We have also considerd that with new domain we don't have good organic search results within few first months. So we try to see the bigger picture and consider SEO future. SO QUESTION IS:
Lets leave brand marketing out, then what would you suggest to do? To stay with 6 different DA 30-40 domains or build one stong domain with 6 different brand subpages? We cant use subcategories. All subpages products will be clothes. Latetly there as beed many news and articles that subdomains are part of main domain and vice versa we are looking suggestions from this board. As we right now think that as we have weak domains righ now it would be better idea to start building one strong domain.0 -
Why do I get duplicate pages, website referencing the capital version of the url vs the lowercase www.agi-automation.com/Pneumatic-grippers.htm
Can I the rel=canonical tag this? http://www.agi-automation.com/Pneumatic-grippers.htm****http://www.agi-automation.com/pneumatic-grippers.htm
Technical SEO | | AGIAutomation0 -
Backlink: External blog Vs. Internal blog. Which is the best?
Hi, some weeks ago a created a blog: mykeyword.wordpress.com Some one told me that it has got more trust that a "normal" www.mykeyword.com
Technical SEO | | Greenman
Is it true? So, i wrote some articles and dropped a guide (linking inside to mysite.com) to blog. My question is:
Right now i'm writing a lot of article ad i'm looking for the best channel where publish my content (post with link inside). My focus is improving quantity and quality of backlinks. Which way must i use? 1. Use my mykeyword.wordpress.com (give freshness to blog and new backlink)
2. Create ad internal blog mysite.com/blog and add article (without link?)
3. "Don't lose time" - Put new article only in external blog that will link to my site. I must manage a lot of new sites and i should increase SERP position. So, i have to choose the right way right now. Thanks 😉0 -
Considering redirecting my site from .com/us to just .com. What could the possible SERP consequences?
Today we use country-specific .tlds but have the US site on .com/us; .com is now a 'flag-site.' Ikea uses that structure too (.com/.com/us). Looking potential risk to redirecting current US site to .com.
Technical SEO | | KnutDSvendsen0 -
Does anyone see benefit in .com/en vs .com/uk for a UK site?
The client is already on /en and in my opinion there is not much to be gained by switching to /uk
Technical SEO | | Red_Mud_Rookie0