Apache

Fixing Apache on CentOS/RHEL 5 for Drupal

Tags: 

While not strictly a requirement, in the interests of not having crazy URLs on your Drupal site it's recommended to set up your web server to support .htaccess files. This will let you have URLs like "/products/cool/stuff" instead of "?q=products/cool/stuff" - obviously much nicer, and better for both usability and search engine optimization. Well unfortunately on Redhat Enterprise Linux 5 (RHEL) and CentOS 5 (which is basically the same as RHEL) the standard web server, Apache, is set to ignore these files. So here's how to fix it.

Whether you're configuring the virtual host in a separate file or in the main httpd.conf, the change you'll want to make is the same:

Step 1: enabling .htaccess files:

  • In the main httpd.conf file (should be at /etc/httpd/conf/httpd.conf) search for the string "AccessFileName",
  • If the line is commented out (it starts with "#") uncomment the line by removing the "#" symbol,
  • Update the line to say:
    • AccessFileName .htaccess
  • Restart Apache, reload the site and.. enjoy the error message :-)
  • On to the second part..

Step 2: allowing .htaccess files to override settings:

  • Find the VirtualHost configuration for the Drupal site,
  • There should be a <Directory> section within that block,
  • If there isn't a line that starts with AllowOverride, add a new one within the <Directory> block,
  • Set the AllowOverride line to the following:
    • AllowOverride Options Indexes Limit FileInfo
  • Restart Apache again.
  • Et voila.

This will allow the Drupal .htaccess file to run and make your URLs all nice & shiny!

Cleanly install RMagick on OSX Leopard

Tags: 

Apple's latest Mac OSX release, 10.5, dubbed "Leopard", does a great job to remedy the problem Rails developers had with previous releases - Ruby is now installed and works correctly, with Rails and a whole bunch of other common gems installed too. Awesome stuff. The one thing they missed, however, was the graphics manipulation package RMagick, but thankfully OnRails.org has put together a tutorial for installing RMagick that covers everything needed to get it working.

Tip: Rails on OSX, Apache 1.3

Tags: 

Here's a little tip for running Rails apps on OSX's default install of Apache 1.3: make sure the dispatch.cgi file has the correct shebang line, i.e.:

#!/usr/local/bin/ruby

In the app I was trying to run it was set to a different path so wouldn't work - lots of hair-pulling later and I got it working.

Migrate SSL certs from IIS to Apache

Tags: 

Migrating away from IIS feels like taking a breath of air on a cool, crisp morning - it is thoroughly invigorating and refreshes your entire body^H^H^H^Hserver. Aside from the basic site configuration, the only tricky part is getting the SSL certificates out of IIS and into Apache. As it turns out there are only a few short steps - export the certificate out of IIS, run three commands in DOS and then hook 'em up in your httpd.conf! Pretty easy, as Pete Freitag explains the steps. After doing this for five domains today, I can tell you that it works and is really pretty painless, much less painless than renewing certificates in IIS.

Reasons to use Apache instead of IIS

Tags: 

I've been a web server administrator for many years, typically as a secondary task along side web development, and I'm reminded time after time how much I dislike using IIS, Microsofts web server. As a gift to the universe, here are my reasons for disliking IIS and preferring Apache:

  • SSL management is a pain. When renewing certificates in IIS you have to create a dummy web site and do several side-steps and tangos. With Apache you simply renew the certificate at the certificate authority and replace the file on your server (or paste it into the control panel, if you have one).
  • Clean URLs. Apache comes bundled with a plugin for turning ugly URLs like "http://www.mc-kenna.com/index.php?function=blog&id=5" into "http://www.mc-kenna.com/blog/5". IIS doesn't have one built-in and the addons I've tried have been a bit odd.
  • Configuration files vs registry. Apache uses plain text files for all of the configuration and can load files from any directory you might have on the server, so that...
    • you can keep your site's configuration nestled within your site's codebase (outside of the publicly accessible directory structure, of course) for revision management;
    • it makes it easy to write scripts to create new sites as they're all very much the same;
    • you can more easily find the setting you want to change.

    With IIS 6 (and older) you use a GUI tool that updates registry settings - not very script or revision management friendly and at times difficult to get around.

It is worth noting at this point that the upcoming IIS 7, bundled as part of Windows Server 2007 aka "Longhorn", will use text files for configuration, I guess they finally saw the benefit of doing it this way.

The way I see it there's one reason to use IIS over Apache:

  • You need to use ASP or .NET.

otherwise you should use Apache.

Pages

Subscribe to Apache