Vote 2

Linux: How To Make RAID-1 Disks Independently Bootable

October 5th, 2008

The best part of Linux (imho) is the ability to replicate not only the operating system or the data but also the boot loader. This allows you to have two identical disks running RAID-1, each of which are independently bootable, should one of them fail. You can also add spare disks to the RAID-1 array to automatically use it to reconstruct the RAID-1 array when one of the RAID-1 disks fail. However configuring it may not always be the simplest. Let's see if I can simplify it for you.

The boot partition (primary partition) can be RAID-0 or RAID-1. Only a fool would configure the boot device as RAID-0 and double the chance of failure. However when you configure it as RAID-1, you are making your boot device 100% redundant and hence robust.

BTW: Can you boot on a RAID-1 drive in Windows? … NO.

Read more (307 words) »

Vote 3

How To Automatically Start Nginx & Fastcgi on Reboot on Fedora Linux

August 10th, 2008

nginx [engine x] is a high quality, light footprint (much ligher than Apache HTTPD), high performance HTTP server and mail proxy server written by Igor Sysoev. nginx is distributed under BSD license unlike its competitor Lighttpd. We are progressively transferring our sites over to nginx. Today when I had to restart the server, I realized (after few hours) with horror that we had forgot to add the script to start nginx automatically after reboot. When you want any command to execute everytime after a reboot you should add it to /etc/rc.local. The commands in rc.local are executed *after* all the other init scripts. To automatically start nginx as well as fastcgi on reboot you should add the following lines to /etc/rc.local at the end -

Read more (300 words) »

Vote 3

Nginx: How To Stop Referrer Spam With Keyword Filtering

August 8th, 2008

You can configure Nginx to stop referrer spam by checking for bad keywords like tramadol, phentermine etc. This reduces the load on your server as well as prevents filling your referrer logs with invalid entries. Here is my nginx configuration to stop referrer spam (feel free to copy it):
Read more (139 words) »

Vote 2

Nginx: How To Redirect /index.php To / To Avoid Content Duplication

August 8th, 2008

Normally any website that responds to /index.php also responds to /. This has the potential to duplicate content. So how can you re-direct /index.php to / without causing infinite loop in nginx?

Here is a simple solution:

Read more (77 words) »

Vote 1

GoDaddy Profits Off Your Unused Domains, Is It Fair?

August 8th, 2008

GoDaddy is a arguably the largest domain name register. Yet it does something which I am not very comfortable with - make profit off your domain names and does that without your explicit permission. Previously when you wanted to register a domain name you had to provide at least two domain name servers. With GoDaddy you can register any domain name without having to specify DNS servers for it. You are not even given the option to specify your own DNS servers. So how does GoDaddy supply the required DNS servers?

Read more (171 words) »

Vote 5

Nginx Hacking Tips

July 12th, 2008

Nginx LogoNginx is a high performance web server and mail proxy server written by Igor Sysoev and a good replacement for Apache HTTPD, the market leader. Nginx is rapidly increasing its market share with major websites joining it like wordpress.com. In the June 2008 Netcraft survey LiteSpeed lost more than 600 thousand sites during this survey, while nginx gained more than a million sites; more than doubling in numbers. The WordPress blogging system recently converted all of its load balancers to nginx, using the upstream hash module to serve 8-9 thousand requests per second. We too have decided to move some of our websites to Nginx. Here are few essential tips and general guidelines for configuring Nginx. This is not a substitute for reading the documentation (rtfm). However when you are stuck even after reading and re-reading the nginx documentation then read below. You will understand the value of the tips below only then :)

Read more (1037 words) »

Vote 4

Tips on Configuring Nginx for Virtual Hosting

July 10th, 2008

Nginx tutorials and examples doesn't tell you how you can configure nginx with virtual hosting when different sites are in different pre-defined directories. Often you are moving over your site from a different web server like Apache HTTPD to Nginx. So you have a pre-defined directory structure which may not be easy to change. Configuring nginx is somewhat tricky in this scenario because nginx isn't very flexible in accepting directives everywhere. After much experimentation we came up with this simple way:
Read more (242 words) »

Vote 3

How To Run phpBB on Nginx With Virtual Hosting

July 10th, 2008

We now have our phpBB forum running on Nginx web server, a high quality and significantly better performing web server than Apache HTTPD. Soem of the challenges we faced were:

  1. We use nice permalinks in the forum so there are lots of apache httpd rewrite rules in .htaccess files which had to be converted to nginx format.
  2. Additionally we also had to configure it for a virtual hosting setup where the same IP address (server) is shared by multiple websites.

Read more (395 words) »

Vote 6

Ngnix: Solution for Directory Resolution Problem in Virtual Hosting

July 9th, 2008

Nginx displays a peculiar but logical behavior when handling directories specified without the ending slash. For example you have a directory like http://www.example2.com/dir/. However you specify the url as http://www.example2.com/dir. Also assume that you have configured the server for virtual hosting and the alternative server names are: www.example.com, www.example2.com etc. and they are specified in the same order. Now when you try to fetch http://www.example2.com/dir you will instead be redirected to http://www.example.com/dir. Here is why nginx does it along with a simple solution to the rather baffling problem (ok complex problem - I said it).

Read more (273 words) »

Vote 1

How To Safely Redirect /index.php To / Using .htaccess / Apache

June 28th, 2008

Any PHP based software like WordPress, Mambo, Joomla, Drupal, MODx etc. will serve pages both from http://your-site.com as well as http://your-site.com/index.php. This creates duplicate content for search engines, which may then decide to penalize your site for duplicate content. You can safely prevent duplicate content with the following apache code / directive added to your .htaccess file (or in httpd.conf):

Read more (215 words) »