Question: I'm looking for either freeware or the programming basics to power off/on a hard drive. Mounting and unmounting a hard drive is simple enough just using the command prompt in Windows XP. Now I need to be able to power down the hard drive so it will not become damaged when being unplugged. I would prefer this to be a simple doable in the command prompt, a simple script, or at worst C++/C#. Freeware that does this exact requirement would also do the job.

This script/program will run on Windows XP with .NET 2.0 SP1.

Answer: 
Please see <http://nginx.org/en/docs/http/request_processing.html> for a description of how nginx handles a request, including locations. The wiki documentation also has some good examples. Unfortunately, a currently undocumented feature is what you want here, most likely.

As mentioned previously, only one location wins in NginX; however, you may not know that nginx supports locations within locations. So your location strategy might actually be like this example server (fastcgi.conf in 0.8.31+):

```
upstream my-backend {
  localhost:9000;
}
server {
  listen 80;
  server_name my-awesome-php.site;
  root /path/to/root;
  # The protected location
  location /protected {
    auth_basic "Give me codes.";
    auth_basic_user_file /path/to/.htpasswd;
    location ~ \.php$ {
      include fastcgi.conf;
      fastcgi_pass my-backend;
    }
  }      

  # Normal files (blank location is OK, just means serve from root)
  location / {
  }
  # PHP for normal stuff
  location ~ \.php$ {
    include fastcgi.conf;
    fastcgi_pass my-backend;
  } 

}

```
The reason for this is because nginx will choose the most specific location block available. A location matched by a regular expression will triumph over a pure string match.

So when you have a request for /madmin it matches your auth location, but anything ending in .php will go to that first.

The reason location ~^ /madmin serves php-code without parsing is because ~^ halts the search if the following regular expression matches.

You can see the location documentation here: <http://wiki.nginx.org/NginxHttpCoreModule#location>