Few days ago I have installed nginx on one of our adult projects as reverse proxy server and for static files management. Yesterday this server got 200Mbit/sec traffic and because all admins like to create miscellaneous graphs, I have decided to draw nginx stats on graphs to see server load not only in megabits and load averages. As the result, I have created perl script, which uses RRDs perl module to create and manage rrd-database and very beautiful graphs.
Archive for April, 2006
In one of my previous posts I have described very powerful Unix admin tool – Nginx. As I said, main problem of this server is lack of English documentation. That is why I decided to write this post with list of typical nginx configurations and example configuration snippets for these configurations.
General way to implement tcp servers is “one thread/process per connection”. But on high loads this approach can be not so efficient and we need to use another patterns of connection handling. In this article I will describe how to implement tcp-server with synchronous connections handling using epoll() system call of Linux 2.6. kernel.
If you have your own home network with two or more computers, you definitely know all of the problems with concurrent access to internet channel. Most annoying problem is bandwidth sharing: when you are trying to use remote ssh connection to some server, and at the same time your wife/brother/friend decided to watch some new and very cool video clip at Google Video or YouTube, your connection will be stalled and you can forget about comfortable work. In this small article I will give you a simple solution for this problem and you will be able to do anything without worrying about traffic sharing problems!
Sometimes we need to connect two or more geographically distrubuted ethernet networks to one broadcast domain. There can be two different office networks of some company which uses smb protocol partially based on broadcast network messages. Another example of such situation is computer cafes: a couple of computer cafes can provide to users more convinient environment forr playing multiplayer computer games without dedicated servers.
Both sample networks in this article need to have one *nix server for bridging. Our networks can be connected by any possible hardware that provides IP connection between them.
Plotting traffic graphs is one of the most popular UNIX admin tasks. Mrtg is a great tool and it is widely used for plotting traffic graphs. It can be easily set up to plot statistics for any SNMP-enabled device (including Linux servers running snmpd). But sometimes we can not setup snmp daemon in Linux server because of small amount of memory or because of some another reasons. How we can plot our favourite graphs in such cases?
Today, I want to describe one of the interesting tools I am using in my job. This tool is nginx – small, but very powerful and efficient web server created by Igor Sysoev for large Russian web company Rambler and kindly provided by open-source community. This server can be used as standalone HTTP-server and as reverse proxy server before some Apache or another “big” server” to reduce load to backend server by many concurrent HTTP-sessions. As standalone web server, nginx can easily handle huge http-load on static files (images, html-pages, etc).
Some years ago I decided to stop using public mail services and decided to buy my own domain and to setup my own mail server at home to handle all of my email. Work was completed very quickly and I got my own working e-mail server and my own mail domain! Some time there was no problems and I was glad to have an opportunity to have full control over my own mail flow.
But little bit later my ISP decided to make my Internet connection cheaper (for them) and they were assigned private IP address to my home Internet connection (192.168.192.2). As you can predict, from that moment my mail server was not reachable from real world and my mail domain was down.
First available solution was to point my MX record to some real mail server in real Internet and to use fetchmail or something like it ti fetch my email to home server. But this solution was not so flexible, and I decided to take one of IP addresses from IP pool of my employer (I am working for hosting company and company owner approved configuration described here) and to assign it to my home server to make my SMTP server available from real world. “It is impossible”, you can say, “You can not set foreign real IP to interface in PRIVATE network of another ISP!”. Yes, it is true, but using some tricks with Linux policy routing an some tunnelling I can do it! This article is about how it has been done by me.