| Author |
Message |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 28/01/2008 23:27:46
|
Cars2007
Joined: 25/01/2008 23:52:18
Messages: 20
Offline
|
For a long time I scratched my head over this: Smith-enabled sites must be served from within the Tomcat directory structure. At the same time, Apache is required to handle PHP, Perl, and other languages. So, how do you implement a site that relies on both PHP and ColdFusion?
After discussing some ideas with a coworker, I figured out that it is possible to have "mixed" sites where Apache+PHP handles PHP files, and Apache+Tomcat+Smith handles CFM files - even if they are in the same directory. All it takes is two symlinks! (In Windows you will have to use the "linkd" utility, available from Microsoft.)
First you'll want to shut down Apache and Tomcat, since you are messing with their internals. Make backups of your httpd.conf and your entire Tomcat directory in case you mess anything up and have to revert.
In Apache's httpd.conf, where you would normally put: JkMount /* worker1
You instead put: JkMount /*.cfm worker1
In /opt/tomcat/webapps, rename ROOT to ROOT-old and symlink /path/to/your/application to ROOT, e.g. ln -s /usr/local/apache/htdocs/sitename /opt/tomcat/webapps/ROOT. Assuming you have already deployed Smith, you would then copy META-INF and WEB-INF into the ROOT directory (which has just been symlinked to your site's directory.) You could even symlink them instead of copying them.
Use .htaccess or other directives to deny GET access to META-INF and WEB-INF.
Now, start Apache and Tomcat. You should find that Apache successfully hands off requests for all .cfm files to Tomcat/Smith, but continues to handle .php, .shtml, etc. by itself.
This has the following effects:
You can have PHP, CFM, and other languages all supported in the same webapp, and even in the same directory. You do not have to copy or symlink your .cfm files from your main web directory into the Tomcat/Smith directory heirarchy. You do not have to try to run your PHP apps on Resin, which they might not be compatible with. Perl, Ruby, and any other Apache-compatible language is also supported in the same way. Smith becomes the "root context" in place of the default Tomcat "welcome" page. You can visit that application by going to yourserver.com:8080/ROOT-old. Its links to Status and Tomcat Manager become incorrect because it assumes it is still in the root context. Just take /ROOT-old out of the path and they will load OK. I do not know whether this can work with .jsp files, since they are handled by default from the root context of Tomcat (which you have replaced with Smith.) I don't have any to test with. If your application uses .jsp files, this might not work. If anyone can test this and report back in this thread, it would be great.
If someone figures out a more elegant way of doing this, feel free to post here.
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 26/03/2008 03:54:32
|
tedxas
Joined: 03/03/2008 21:29:04
Messages: 3
Offline
|
How would I apply this to a server hosting multiple websites? Could I run some websites as PHP and others as Smith?
|
|
|
 |
![[Post New]](/forum/templates/default/images/icon_minipost_new.gif) 26/03/2008 19:50:12
|
Cars2007
Joined: 25/01/2008 23:52:18
Messages: 20
Offline
|
You would use virtual hosts in that case. Each virtual host can either use the Jk connector, or not.
|
|
|
 |
|
|
|
|