Sep 132013
 

This is an article of mine first published on Wazi.

Apache is still by far the most widely deployed HTTP server, according to the latest Netcraft web server survey, but nginx has been slowly, steadily gaining market share, thanks to its blazing speed. If you want to try a faster web server and move from Apache to nginx, you’ll probably have to change some of your websites’ configurations, starting with rewrite directives. To migrate rewrite rules from Apache to nginx, start with these tips and tricks.

The Apache mod_rewrite module provides powerful and sophisticated tools for nearly all types of URL rewriting. It is, however, somewhat complex, and may be intimidating to beginners. In fact, however, rewrite rules are not magical incantations, though to understand them you need some understanding of regular expressions.

Even if you have never heard of mod_rewrite, you may still be using it. Popular applications such as WordPress, Drupal, and Magento are shipped with .htaccess files that contain standard configurations that make these applications work properly, and these usually include one or more rewrites, so to properly move your website to an nginx web server you have to “translate” the Apache mod_rewrite directives into equivalent rules for nginx’s HttpRewriteModule.

Continue reading »

Flattr this!

Jan 302013
 

When you run a webserver behind a reverse proxy or HTTP accelerator such as Varnish, the webserver access logs will display the IP of the proxy (generally 127.0.0.1) instead of the end user’s IP.
This is a problem when you have a software like webalizer, awstats or similar log file analysis program, because you lose one of the most important information: “Who is the requestor of a page ?”, also having all the access coming from the same IP (127.0.0.1) you lose information such as “what’s the browsing pattern of visitors ?” “Is someone trying to do something Nasty ?”

In this small how-to I’ll show how to put this information back on your Nginx log files in 2 different ways.

Continue reading »

Flattr this!

May 162012
 

Varnish is a great tool that accelerates the performance of your site with a simple configuration and a low usage of resources, compared to the result you’ll get. Just because Varnish is designed and engineered to be fast by default it does not write any log to disk, outrageous you could think … to be honest the logs are available in a memory segment when this memory is filled, Varnish starts from the beginning and overwrites the oldest data in an infinite loop.

So in reality there are logs and they are available for some time, and this solution is much, much faster then logging to a file and it doesn’t require disk space, but how we can get them on file, possibly divided by virtual host as do Apache or Nginx ?
Continue reading »

Flattr this!

Tips and Tricks for Nginx

Nginx is an emerging Web server (it claims to power around 12% of the website) and is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. Personally I’m using it from 2010 and so far so good, no particular problems, it does perfectly his work and is frequently updated […]

How to put Varnish in front of your Webserver without doing any change.

Varnish is an open source “web accelerator” which you can use to speed up your website. It can cache certain static elements, such as images or javascript but you can also use it for other purposes such as Load balancing or some additional security, in general most of the people want to try it and […]