background preloader

NGINX

Facebook Twitter

Optimizing Nginx for High Traffic Loads. I have previously talked about some of the most common nginx questions; not surprisingly, one such question is how to optimize nginx for high performance.

Optimizing Nginx for High Traffic Loads

This is not really overly surprising since most of new nginx users are migrating over from Apache and thus are used to having to tune settings and perform voodoo magic to ensure that their servers perform as best as possible. Well I’ve got some bad news for you, you can’t really optimize nginx very much. There’s no magic settings that will reduce your load by half or make PHP run twice as fast. Thankfully, the good news is that nginx doesn’t require any tuning because it is already optimized out of the box. The biggest optimization happened when you decided to use nginx and ran that apt-get install, yum install or make install. That said, there’s a lot of options in nginx that affects its behaviour and not all of their defaults values are completely optimized for high traffic situations. Why is FastCGI /w Nginx so much faster than Apache /w mod_php? (this post has a sister post on Apache’s event MPM compared to Nginx) I was originally going to write a blog post about why NginX with FastCGI was faster than Apache with mod_php.

Why is FastCGI /w Nginx so much faster than Apache /w mod_php?

I had heard a while ago that NginX running PHP via FastCGI was faster than Apache with mod_php and have heard people swear up and down that it was true. I did a quick test on it a while back and found some corresponding evidence. Today I wanted to examine it more in depth and see if I could get some good numbers on why this was the case. The problem was that I couldn’t. To test I did a simple “hello, world” script. The baseline tests show the following. Apache w/ mod_php. Tuning nginx worker_process to obtain 100k hits per min. Tuning Nginx for Best Performance - Dakini's Bliss. Created on 22 April 2012 Chloe Hits: 13719 This article is part 2 of a series about building a high-performance web cluster powerful enough to handle 3 million requests per second .

Tuning Nginx for Best Performance - Dakini's Bliss

Nginx Vs Apache in AWS – Updated. According to your comments we’re publishing the data regarding tests conducted using “workers = 2″ in Nginx.

Nginx Vs Apache in AWS – Updated

Other optimization were excluded due to the fact that the point of this benchmark was to find the correct sizing of AWS resource used in this HA structure: type of EC2 instances, size of RDS databases and the needing of PIOPS on EBS volumes. Given that we managed to keep the test fair, using only the production ready versions of the webservers, avoiding external “poisoning” like php caching or excessive tuning.There are a lot of post in the Net explaining how to use APC, iozone or nginx’s micro-caching, there’s no need of another one.Besides, we want to thank you for your valuable comments that help us to improve the blog contents.

Yet another Nginx Vs Apache comparison? Yes, but you should continue reading it because we ran all the benchmark in the AWS Cloud using all the resources suitable to this test: ELB, EC2, EBS, RDS and ElastiCache. Benchmark Scenario: Dashboard. This is part 2 of a quasi-series on hardening node.js for production systems (e.g. the Silly Face Society).

Dashboard

The previous article covered a process supervisor that creates multiple node.js processes, listening on different ports for load balancing. This article will focus on HTTP: how to lighten the incoming load on node.js processes. Dashboard. Administration. There is a new revision of this tutorial available for Ubuntu 15.10 (Wily Werewolf).

Administration

Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption. This tutorial shows how you can install Nginx on an Ubuntu 14.04 server with PHP5 support (through PHP-FPM) and MySQL support (LEMP = Linux + nginx (pronounced "engine x") + MySQL + PHP) . I do not issue any guarantee that this will work for you! 1 Preliminary Note In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root: sudo su 2 Installing MySQL 5 In order to install MySQL, we run apt-get install mysql-server mysql-client New password for the MySQL "root" user: <-- yourrootsqlpasswordRepeat password for the MySQL "root" user: <-- yourrootsqlpassword.

Administration. Administration. The nginx web server is a fast, lightweight server designed to efficiently handle the needs of both low and high traffic websites.

Administration

Although commonly used to serve static content, it's quite capable of handling dynamic pages as well. This guide will help you get nginx up and running with PHP via FastCGI on your Ubuntu 12.04 LTS (Precise Pangolin) Linux VPS. It is assumed that you've already followed the steps outlined in our getting started guide . These steps should be performed via a root login to your Linode VPS over SSH. Before you begin installing and configuring the components described in this guide, please make sure you've followed our instructions for setting your hostname . Hostname hostname -f The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN). Create Directories. Administration. If you want to redirect traffic to a different subdomain, you can add a rewrite clause into each of your server{} entries in /etc/nginx/sites-avaliable/default or where ever you keep your available sites located.

Administration

This setup still allows me to have multiple virtual hosts on the same box behind an nginx reverse proxy. For this example, I have a DNS A record for examplehost1.com, blog.examplehost1.com and www.examplehost1.com pointing to the same IPv4 address. examplehost2.com and www.examplehost2.com have their own A records pointing to the same IPv4 address. Nginx will match the incomming server name in the headers of the request. If the server name is examplehost1.com, nginx will send a 301 redirect in the response to www.examplehost1.com. The same applies if the server name in the request is blog.example1.com. Administration. Note: "VirtualHost" is an Apache term.

Administration

Nginx does not have Virtual hosts, it has "Server Blocks" that use the server_name and listen directives to bind to tcp sockets. Two Server Blocks, Serving Static Files A Default "Catch All" Server Block Wildcard Subdomains in a Parent Folder This is just a really easy way to keep adding new subdomains, or to add new domains automatically when DNS records are pointed at the server. Google. <UPDATE> : this document has been updated.

Google

You still can and should read it, but target configuration is described here: NGinx automatic vhosts configuration with subdomains, SSL and authentication support - second version. </UPDATE> La version Française est disponible ici: Configuration d'hôtes virtuels sur NGinx avec support automatique des sous-domaines, du SSL et de l'authentification. Introduction.