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
-
www vs non-www
We have 2 variations of domains. www and non-www
Technical SEO | | aaaannieee
Both can be seen by users and have been linked to on press releases, but only the www one has data on Google Search Console.
In the case, what is the best practice for us?0 -
Full Ecommerce vs seperate shop section
Just wondering is anyone had any thoughts on whats the easiest for SEO purposes. My main focus is to get people to buy our installation services. We could either a) Have a full ecommerce website and on every product we can advertise the fact that we install the products. As well as creatign additinal CMS pages OR b) Create a content driven site promoting our installation services and then having a separate tab at the top which can be very prominent called Shop or Buy online. The customer can then visit that page for DIY products. Would either option be a better option for SEO purposes/usability for the customer?
Technical SEO | | paulfoz16091 -
Would these be considered dynamic URLs?
Hi, I have a (brand) new client (outdoor recreation), and it links to many different lodges. It's built in Wordpress (Pagelines), and the partner page link URLs. Although they do have the "?" in there, it's only has a single parameter. http://www.clientsite/?partners=partner-name Google is indexing the URLs, I do plan to increase the amount of content/on-page for each. Yet, weighing the risk/reward of rewriting all of these URLs.
Technical SEO | | csmithal0 -
Squidoo vs Personal Site
Hey guys I'm Nikolas a newb, just signed up to the pro membership trial after alot of digging on the seomoz blog for months . First off let me tell you alittle about my story and seo knowledge. I started off online on the well known squidoo site with revenue sharing, because of my day job I had alot of time to work on my articles and build up to a nice monthly salary of just over 1k in less than 5 months which doubled and trippled in the last few months. Seo is like a 6th sense to me , onpage offpage and the lots. Most of what I read here is not new to me or something I didn't already know about, but its good to freshen up and remember things, as theres alot to search engine optimization. I have built up to over 500k unique visitors in less than a year and have decided to move on to my own site 4 months ago. The niche is the exact same one I have targeted on squidoo. My site had alot of issues at the start the classic 301 redirection ht_access fix I had to do,content management system building low quality content pages via tags that i have fixed(noindex) and removed with 404s, build up original unique valuable posts, interlink ,onpage and offpage seo the basics I did for squidoo. The problem here is that I can't seem to get any traction from google where as my squidoo search engine traffic is 80% , my sites google traffic is 5-10%. I have the same number of articles on both sites, similar topics , similar onpage offpage optimisation basically identical but have alot better content on my new site. My bing, yahoo and referral traffic is rising everyday but as I know google is 85% of the market share I am leaving alot of money on the table. I hope that most of you more dedicated seo's can give me a tip or two and explain exactly what is going on with my situation and if possible take a look at my site hardwarepal .
Technical SEO | | NikolasNikolaou0 -
Is this considered Duplicate Content?
Good Morning, Just wondering if these pages are considered duplicate content? http://goo.gl/t9lkm http://goo.gl/mtfbf Can you please take a look and advise if it is considered duplicate and if so, what should i do to fix... Thanks
Technical SEO | | Prime850 -
Permanent 301 redirects vs canonical urls?
Im moving a website that was .php to wordpress with a few static HTML pages. Which is better use permanent 301 redirects and delte the old pages, leave the old pages and use canonical urls and 301 redirects or something else?
Technical SEO | | senith0 -
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 -
Is this considered as duplicate content?
One of my clients has a template page they have used repeatedly each time they have a new news item. The template includes a two-paragraph customer quote/testimonial for the company. So, they now have 100+ pages with the same customer quote. The rest of the page content / body copy is unique. Is there any likelihood of this being considered duplicate content?
Technical SEO | | bjalc20110