background preloader

Dashboard

Dashboard
This is part 2 of a quasi-series on hardening node.js for production systems (e.g. the Silly Face Society). 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. Update: I’ve also posted a part 3 on zero downtime deployments in this setup. Our stack consists of nginx serving external traffic by proxying to upstream node.js processes running express.js. Too much talk. Also available as a gist. Perhaps this code dump isn’t particularly enlightening: I’ll try to step through the config and give pointers on how this balances the express.js code. The nginx <-> node.js link First things first: how can we get nginx to proxy / load balance traffic to our node.js instances? The upstream directive specifies that these two instances work in tandem as an upstream server for nginx. GZIP GZIP is a no-brainer for HTTP.

Administration There is a new revision of this tutorial available for Ubuntu 15.10 (Wily Werewolf). 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 3 Installing Nginx apt-get install nginx

Administration The nginx web server is a fast, lightweight server designed to efficiently handle the needs of both low and high traffic websites. 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 . 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 In this guide, the domain "example.com" is used as an example site. mkdir -p /srv/www/www.example.com/public_html mkdir /srv/www/www.example.com/logs chown -R www-data:www-data /srv/www/www.example.com File: /usr/bin/php-fastcgi #! #!

Administration Note: "VirtualHost" is an Apache term. 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. 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. 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. The examplehost2.com will make sure all of its traffic ends up at www.examplehost2.com. There are other methods of redirection, but I find this the easiest when you have multiple virtual hosts setup on an nginx reverse proxy. /etc/nginx/sites-available/default

Google <UPDATE> : this document has been updated. 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 NGinx webserver installation, configuration and managment can be time consuming. Virtual hosts basis NGinx webserver, like any modern webserver, is able to handle many virtual hosts, means that you can host many domainname on same IP adress. This is quite easy, except when you want to use SSL. Finally, you can create and maintain your own certificate but people connecting to your website will have an alert until they validate your own certificate. For now, we assume that 1 IP address = 1 domainname. Environment preparation Automating vhosts managment require some organisation. config auth ssl logs

Nginx Vs Apache in AWS – Updated | Celingest Blog – Feel the Cloud According to your comments we’re publishing the data regarding tests conducted using “workers = 2″ in Nginx. 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? Benchmark Scenario: These are the relevant parts of Apache and Nginx configurations: httpd.conf nginx.conf The results: m1.small EC2 instance: 1.7 GiB memory 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)

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 . For this part of the project, you can use any web server you like. I decided to use Nginx, because it's lightweight, reliable, and fast . Generally, a properly tuned Nginx server on Linux can handle 500,000 - 600,000 requests per second. It's important to know that everything listed here was used in a testing environment, and that you might actually want very different settings for your production servers. Install the Nginx package from the EPEL repository. yum -y install nginx Back up the original config, and start hacking away at a config of your own. cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig vim /etc/nginx/nginx.conf Start up Nginx and set it to start on boot. service nginx start chkconfig nginx on Now point Tsung at this server and let it go. tsung start Web server tuning, part 2: TCP stack tuning

Tuning nginx worker_process to obtain 100k hits per min

Related: