Entries Tagged as 'Apache'

Why the switch to mod_proxy from mod_jk?

I've talked about this a lot in various places, but because I expect to get a few questions about this, I want to create a post where I could fully explain the decision to move from mod_jk to mod_proxy. As of Version 4 of the Railo Installer, mod_proxy_http will be configured by default in Linux Apache installations.

Current Installs Will Continue to Function

If you're comfortable using mod_jk, then there's no reason for you to migrate any of your existing installation to mod_proxy. mod_jk will continue to work just fine with Railo and Tomcat for as long as the Tomcat developer community continues to develop and improve mod_jk. There is no reason to switch if you're comfortable where you are.

Mod_proxy is Simpler to Configure

There are sevaral points to make within this overall "mod_proxy is simpler" point. First, it should be noted that mod_proxy is installed by default in nearly all modern Apache installs. Even Windows version. So as far as "installing" mod_proxy goes, it's incredibly easy because in most cases it's already there! Second, mod_proxy is configured purely by a few commands within the Apache configuration file. Mod_jk has several different configuration files you have to work with. These additional files are the cause for much confusion among users about what to edit, when to change it, and what to change it to in order to do what you want. Once you know the purpose of each file for mod_jk, it's really not very difficult, but it can be daunting to try to figure it out, or if you're on an unfamiliar system, find where those specific files are located. With mod_proxy, you can simply look at the proxy rules, and generally have a pretty good idea of what's going on without having to track down and review separate configuration files.

Mod_proxy is Recommended by Tomcat Dev Team

This article describes in detail the differences between the current connection methods: http://www.tomcatexpert.com/blog/2010/06/16/deciding-between-modjk-modproxyhttp-and-modproxyajp

Note that the article was written by Mark Thomas, a member of the Apache Foundation and Tomcat Developer.

Mod_proxy Fits Better into Future of CFML

There are many features that would be very useful when connecting Apache to Tomcat with regards to the CFML development language. For example, it would be nice if users could have some built-in support for Search Engine Safe URL's without having to add complex mappings to their Apache configurations. It would also be nice to have the ability for Apache to pass on certain aspects of its configuration to Tomcat from within the HTTP protocol. Work in that area has started with the mod_cfml project, but it would be great if mod_cfml could run as a native Apache module instead of as a mod_perl module. Mod_perl is fantastic software, but some users resent having to install it in order to get mod_cfml working in Apache.

With mod_proxy, we can extend mod_proxy's existing functionality and add our own - in much the same way that mod_proxy_ajp and mod_proxy_html extend the base functionality of mod_proxy, we could potentially create a mod_cfml module that is simply an extension of mod_proxy where basic support for CFML pass-throughs are built in directly to the module. This would make installation and configuration even easier then it is currently.

ColdFusion 9 CentOS 6 Connector Issues

Just had an experience installing ColdFusion 9 on to a CentOS 6 system and ran into an issue installing the web connector. I'll step through the process I went through and maybe it will help others installing Adobe ColdFusion on to CentOS 6.

Right after the installation, I got the following error message:

Running apache connector wizard...
=======================================
There was an error while running the connector wizard
Connector installation was not successful
=======================================

This is the output of the cf-connectors.sh script, located here:

/opt/coldfusion9/bin/cf-connectors.sh

You can manually run that script and get the same error message. Looking at the script, I saw I kept a log of it's issues in the following file:

/opt/coldfusion9/ConnectorInstall0.txt
SELinux Penguin Logo

So I naturally checked it out. The first error I got had to do with Apache APXS not being installed. Again, my CentOS 6 install was a "minimal" install, so I was used to installing additional packages to get things to work properly. To address this issue, I just ran the following:

yum -y install httpd-devel

Then ran the cf-connectors.sh file again, and ran into a different issue this time. This one was more peculiar:

Starting httpd: httpd: Syntax error on line 892 of /etc/httpd/conf/httpd.conf: Cannot load /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so into server: /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so: failed to map segment from shared object: Permission denied

That's odd... I'm running as "root", I shouldn't be getting permission issues. As it turns out, this error is due to SELinux being enabled. However, I an not at liberty to disable SELinux for this particular project, so I had to find a different way. Turns out, the fix just ended up being a simple one-liner to adjust the SELinux config:

chcon --reference=/usr/sbin/httpd /opt/coldfusion9/runtime/lib/wsconfig/1/mod_jrun22.so

After that, Apache started right up and my SELinux rules are still happily in place!

Hope this helps.

mod_cfml graphic

I'm working on the mod_cfml site and while playing with Photoshop and working up graphics for it, I made the following. I really like it! Hope you do too.

mod_cfml logo

The tricky little "httpd -M" command

A project I'm doing requires that I write a BASH shell script that checks what modules are installed in Apache (to make sure some requirements are met before an install is attempted), however, I had a HECK OF A TIME figuring out how to script the checking of the httpd -M command (the command that shows the installed Apache modules). I was tring to run the following on a CentOS 5 server:

# httpd -M | grep -c perl

And the results of the command were not being piped to grep. Instead, the results were being sent to the screen. Irritating! There's clearly a pipe character there. I kept thinking I was writing the command wrong or something. I tried the command on my Ubuntu desktop, and lo and behold it worked just fine:

$ sudo apache2ctl -M | grep -c perl

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Syntax OK
1

Broken ApacheThe "1" was the result I was looking for, because I knew mod_perl was installed.

Long story short, for some reason the CentOS 5 version of Apache sends the "httpd -M" results to stderr, rather then stdout. I have no freaking idea why it does this, because that's not error data. It seems like a bug in the HTTPD executable. The end result was that I needed to write my command as follows:

# httpd -M  2>&1 | grep -c perl

1

The 2>&1 sends the stderr data to stdout which is what the pipe character sends to the grep command.

How annoying. For the record:

# httpd -v

Server version: Apache/2.2.3
Server built:   Oct 20 2011 17:00:12

Hope this helps someone avoid the frustration and confusion I went through finding it.

Install PHP 5.2 on CentOS 5 (for phpMyAdmin)

phpmyadmin logoIt's pretty annoying to me that the latest version of phpMyAdmin requires PHP 5.2, which as some of you may know, is NOT installed on CentOS 5 by default. Instead, you have to use scary-looking RPM's with the word "testing" in them. So... to remove some of the scaryness/complexity of installing PHP 5.2 on CentOS 5 for use with phpMyAdmin, I've written down the following steps that makes the upgrade process pretty easy.

  1. First install the yum-priorities package. This enables you to specify which repo you want yum to prioritize when it's checking for updates.

    # yum -y install yum-priorities

  2. Next, you'll want to add the scary "CentOS 5 Testing" repository to your listof repo's for YUM to check. You can do that by adding the contents of THIS FILE to your own /etc/yum.conf. I just copied and pasted the contents of that file to the very bottom of my yum.conf and it worked fine.

  3. Now you should be able to perform a PHP upgrade with YUM by specifying that you want to use the "testing" server as a priority:

    # yum --enablerepo=c5-testing upgrade php

    or... if you haven't installed PHP yet:

    # yum --enablerepo=c5-testing -y install php

  4. You will probably also want to install the following modules for use with phpMyAdmin:

    # yum --enablerepo=c5-testing -y install php-mysql php-mcrypt php-mbstring

  5. After you're done installing/upgrading php and all required modules, don't forget to give Apache a quick restart so your upgrades take effect:

    # /etc/init.d/httpd restart
php logo


That's all there is to it! Your phpMyAdmin install should work great now.