Nov 22
Are you looking forward to balance HTTP or HTTPS traffic to multiple back-end servers? Nginx is one of the best choices – it’s very lightweight, requires less resources and it’s completely free.
You need to compile the nginx (there are many resources and howto’s) and add the following lines to your nginx.conf file:
upstream webcluster {
server 10.10.10.1;
server 10.10.10.2
server 10.10.10.3;
}
location / {
proxy_pass http://webcluster;
break;
}
Where 10.10.10.1, 10.10.10.2, 10.10.10.3 are the back-end web servers located in internal network defined in upstream settings above. The location / specifies that all URLs should be balanced to back-end servers.
Many folks prefer to serve HTTPS traffic with nginx and then forward all requests via HTTP protocol to the back-end servers. The back-end servers should be located on a safe VLAN or internal network.
Oct 27
Nginx developers have released two patches – one that fixes null pointer reference, gx_http_parse_complex_uri() buffer underflow. Update immediate or your site can be attacked and nginx stopped remotely (so I heard).
Download the latest stable version and recompile the binary. Then run
kill -USR2 nginx_master_pid
Make sure you see new master nginx process running (you will see two master processes), kill the old one:
kill nginx_master_pid
And your site will be safe and screamingly fast once again!
Mar 09
One of the best solutions for streaming Flash video nowadays is Nginx. It’s super fast, lightweight and does easily support thousands of concurrent connections without taking up much resources.
By default flash streaming is not activated and you need to turn it on in compilation process. You enable flash streaming by:
./configure –with-http_flv_module …(add other options here)
and then add to nginx.conf the following settings:
location ~ \.flv$ {
flv;
}
Nginx can easily push hundreds of megabits per second so make sure your upstream can support it and you have deep pockets for bandwidth expenses
Jan 15
Prepare for real performance boost. Run Nginx in a front of Apache and serve all static content directly from Nginx. All php script requests are transparently forwarded to Apache daemon and output forwarded back to Nginx that servers it to a web visitor.
Web visitor -> Nginx -> static content -> Nginx -> Web visitor
if dynamic content then,
Web visitor -> Nginx -> dynamic content -> Apache -> Nginx -> Web visitor
For static content serving you should add the following nginx config:
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|rtf|js)$ {
root /usr/www;
expires 10d;
break;
}
With the following config you will serve all those files directly via Nginx and it will be very fast. Don’t forget to set-up Nginx listening to public IP and Apache configure to a different port or internal IP.
Jan 04
Alright fellows. Many folks are using Nginx nowadays and I thought we need to open a new category dedicated to Nginx. It’s fast, light-weight and reliable web server that’s becoming very popular.
We will soon have some fresh content and howto’s about Nginx. Stay tunned!
Recent Comments