Apache configuration for a simple development server

I’m setting up a CentOS 5.4 laptop to build a new site for St. Kathryn’s Church in Hudson, NH (http://stkathryns.org).

I want to use the server to run other sites as well, so setting up virtual hosts was one of the first steps.

I like to use a dedicated /etc/httpd/conf.d/vhost.conf file for settings that affect all sites on the server.

/etc/httpd/conf.d/vhost.conf

ServerName 127.0.0.1
NameVirtualHost *:80

/etc/httpd/conf.d/localhost.conf has the localhost settings.

<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName 127.0.0.1
ServerAlias localhost
</VirtualHost>

/etc/httpd/conf.d/stkathryns.conf has the settings for St. Kathryn’s new site.

<VirtualHost *:80>
DocumentRoot /var/www/html/stk
ServerName stkathryns.org
ServerAlias stk
</VirtualHost>

The final adjustment is to add the domain name for stkathryns.org into the /etc/hosts file, so I can develop locally, with the correct domain name.

127.0.0.1 localhost.localdomain localhost stkathryns.org stk