An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

Entries Tagged as apache

Customizing Apache Configuration under cPanel

November 07, 2009 ·

This is another "reminder to self" but I thought it might be useful to others... Many VPS servers have a control panel in place to make it 'easier' to manage and configure the system. They can be really useful for handling multiple accounts (for email, FTP), multiple domains and so on. However, they tend to completely manage the web server configuration for you as well and that can make doing certain customizations really, really hard work! I've been working on a server managed by cPanel lately and needed to hook in some Apache rewrite rules and proxy settings to integrate Tomcat and Railo into several of the sites. cPanel applies a very heavy management layer to Apache so it can be hard to figure out what you can safely change - and where to add your own custom directives. Here's a very useful page from the cPanel documentation: Adding Custom Directives to httpd.conf You can add directives at various levels (although the examples are not 100% accurate so be careful to verify what it is actually telling you!). Note that the /usr/local/apache/conf/userdata folder structure does not exist by default so you have to create all your own entries in there. You will find also yourself relying heavily on some commands to verify that your new custom directives are being picked up and also to apply them: /scripts/verify_vhost_includes --show-test-output /scripts/verify_vhost_includes --commit /scripts/ensure_vhost_includes --all-users

Tags: apache

Railo for Dummies Part IV Appendix

March 28, 2009 ·

In the comments on Part IV, Barney suggested using AJP to proxy and I confirmed that it preserves the CGI variables REMOTE_ADDR and REMOTE_HOST which Paul Kukiel asked me about. Paul also noted that adding the ProxyPreserveHost directive causes the host headers to be passed through the proxy. I'd actually added that locally but didn't want to complicate the blog post by mentioning it. In this Appendix post, I want to tackle SES URLs. One downside of Tomcat is that it does not support the following common form of SES URLs: We're going to tackle this by changing our proxy strategy to use mod_rewrite.

[

Tags: apache · coldfusion · osx · railo

Railo for Dummies Part IV

March 27, 2009 ·

After getting a very basic Railo+Tomcat setup running, now we're going to make it more robust and more 'production-ready' (you'll want to do more than I'm going to show so I'd refer you to the extensive Tomcat documentation for deeper configuration). I'm just going to show how to get Tomcat integrated with Apache in a couple of ways so you can run a 'real' website on it.

[

Tags: apache · coldfusion · osx · railo and WebDAV

August 08, 2008 ·

I've been using the free "basic" account on for about two years. They've never really officially supported WebDAV but it worked and I used it to publish calendars for myself and my wife so we could easily subscribe to each other's calendars and keep in sync (we have crazy busy lives!). Over the last two years, they've changed the URL patterns and had numerous bouts of downtime on WebDAV. It was free, it was unsupported, it was only marginally annoying.

[

Tags: apache

Want to see how to install SVN, Apache and Trac?

January 22, 2008 ·

And I mean see... Kev McCabe has posted a series of video tutorials about Apache, Subversion and Trac on Windows. This should be very helpful for folks wanting to set up local version control and bug tracking but who feel a bit daunted by all these packages. Kev takes you through how to install each package and then how to configure them to work together.

Tags: apache · coldfusion · oss

Improving site performance with YSlow

July 25, 2007 ·

If you haven't already heard, Yahoo! has released YSlow for Firebug, a Firefox plugin that analyzes your site for ways to speed things up in terms of HTML, CSS and JavaScript. I installed it an hour ago and it gave my site a performance grade of D with a score in the low 60's. After a few small tweaks, my grade is B and my score is 83. My blog should be noticeably faster to load. The first thing it recommended I do (an "F" on Reduce DNS lookups) was to strip a number of the third-party JavaScript features I'd added over time in order to reduce the number of domains my site referenced. I removed the Technorati, Skype and Twitter JS calls because, well, they really don't add much value. I changed my Site Meter code to use the non-JavaScript version - which also had the benefit of removing attempts to ping which sets a third-party tracking cookie (Google for more details - some people feel Site Meter should have been more open about this change). I also got an "F" for ETags. Reading the Yahoo! site (linked from the YSlow plugin) gave me the Apache magic necessary to disable those (in my .htaccess file):
FileETag none
I have a "B" now because the Developer Circuit widget still has an ETag. An "F" in Expires header scoring became a "D" after I enabled Expires headers for CSS and images (again, in .htaccess):
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
My Gzip components scored improved to a "B" by adding a directive to deflate CSS:
AddOutputFilterByType DEFLATE text/css
Another tweak I made that seemed to help was adding defer="defer" to the Developer Circuit JavaScript include - the only third-party JS left on my site now. The only remaining "red flag" - my one remaining "F" - is the recommendation to use a CDN which isn't really available for free to folks like you and me. If Developer Circuit adds a few Expires headers, enables Gzip and disables ETags then my site will get faster still but I'm impressed with what I've been able to do in a short space of time. Thanx Yahoo! p.s. Also thanx to John Farrar who was the first person to notify me about YSlow!

Tags: apache · coldfusion

Named Virtual Hosts

April 11, 2007 ·

I don't know why but I've never bothered setting up named virtual hosts for local development. I've generally just used multiple ColdFusion instances on different ports or multiple Apache listeners (and port-based virtual hosts). I guess that was related to the type of development I was doing (working for a corporate and thus focused on just one big project at a time). Today I decided that my Apache setup was less than ideal and took the plunge and reconfigured everything to use named virtual hosts instead. It went pretty smoothly because all I did was:
  • Replace existing Alias directives with VirtualHost groups (and copy in any associated Directory group)
  • Changed each port-based VirtualHost group to use *:80
  • Added appropriate ServerName directives with made up domain names
  • Added those domain names to /etc/hosts
  • Restarted Apache (sudo apachectl restart)
Now I can hit or or whatever and get the site I expect. Nice. Why didn't I do this sooner? The only roadblock I hit was that I drew a complete blank on how to enable directory listings (for my local "scratch" ColdFusion instance). I had Options Indexes enabled everywhere but no dice, just "403 Forbidden". I could browse directories on my main document root but couldn't browse directories on any of my ColdFusion domains. I thought it was something deep inside an XML file. After bashing my head against a wall for about half an hour I asked a few folks online. They didn't know. So I did what I should have done in the first place: I asked on the #coldfusion channel on Sure enough, within a few minutes I was up and running. Thanks go to B0llock5 for that! The solution? To add the following directives to the VirtualHost that needed directory browsing:
  • Order Allow,Deny
  • Allow from All
I knew this really so I just felt dumb for blanking on it. Duh!

Tags: apache · coldfusion

Apache, ColdFusion MX 7, MySQL, Eclipse - ACME

September 16, 2005 ·

Stephen Collins has just released the second edition of the ACME guide - a complete guide to installing and configuring a ColdFusion development environment based on CFEclipse that uses Apache and MySQL. A lot of work has gone into this second edition!
Updated link March 1st, 2007.

Tags: apache · cfeclipse · coldfusion

Hate Apache?

August 02, 2005 ·

Part of the fun, interesting and varied content on Fusion Authority - a link to a presentation (PDF, 670Kb) from the European ApacheCon this this entitled "Why I Hate the Apache Web Server". Now, I love Apache but I'll accept that it has some, er, "quirks"... My favorite slide is the one that talks about the powerful mod_rewrite:
I probably don't need to say anything more than just "mod_rewrite". But I will. "Voodoo" and "... flexibility of sendmail" The docs practically scream "GO AWAY!"

Tags: apache · programming

Tiger's iCal and WebDAV

May 31, 2005 ·

After upgrading to Tiger and the new iCal, I noticed that the calendar files are no longer in the same place. In fact, I haven't actually found where the new iCal stores the calendars. That was kind of a pain because I used to push my .ics files up to my ISP so that my wife could subscribe to my calendars (a cron job runs on her iMac to push her calendar to my ISP and a cron job runs on my PB to push my calendars to my ISP). I figured I could publish my calendars to get at the .ics files. iCal publishing supports .Mac and WebDAV. My ISP does not offer WebDAV. Hmm. Guess I could enable WebDAV on my local Apache and publish to that, then use my old cron job to push the files from the webroot up to my ISP... I found these articles about WebDAV on O'Reilly and that helped me figure out most of it. I added a .htaccess file to Limit the WebDAV operations but couldn't write to the new WebDAV setup. Finder could connect, even prompting for the right credentials, but the folder was mounted readonly. Eventually I realized that the DAVLockDB directory path I'd specified didn't fully exist. A quick mkdir and a chmod and everything started working! Now iCal happily publishes to my local Apache setup, my cron job pushes the files to my ISP and my wife can, once again, see what I'm doing. It's the first time I've used WebDAV. It's pretty neat!

Tags: apache · osx