Apache tomcat jsf php

Discussion in 'Server Operation' started by ripit, Jun 20, 2008.

  1. ripit

    ripit New Member

    Hi

    I've installed apache and tomcat with mod_jk and now I wonder how to get it to work with index.php files.

    I have jsf applications up and running on the server and I also got php applications to work but it won't work if I don't type index.php.

    This is my JKMount config in httpd.conf.

    Code:
    JkUnMount /*.php worker1
    JkUnMount /*.html worker1
    JkUnMount /*.jpg worker1
    
    JkMount /* worker1
    JkMount /*/servlet/* worker1
    JkMount /*.war worker1
    and here is my workers.properties:

    Code:
    # Define 1 real worker using ajp13
    worker.list=worker1
    # Set properties for worker1 (ajp13)
    worker.worker1.type=ajp13
    worker.worker1.host=localhost
    worker.worker1.port=8009
    I had to do JkMount /* to get jsf to work. is there any other way to configure this:

    /ripit
     
  2. falko

    falko Super Moderator Howtoforge Staff

    So PHP files are working except for index.php?
    Any errors in Apache's error log? Any errors in your browser when you call index.php?
     
  3. ripit

    ripit New Member

    No everything in php works fine if i type:

    www.test.com/index.php

    but not if I type:

    www.test.com

    when I type the latter i shows the php code for index.php. This I can stop.

    This is of course because tomcat can't parse php, but is there a way to stop apache to call tomcat. Can apache in someway find out what filetype it is before it passes it forward to tomcat.

    I wan't the JkMount /* because otherwise jsf won't work.

    /ripit
     
  4. ripit

    ripit New Member

    I found JkOptions ForwardDirectories but I can't figure out how to get it to work. If I understand it correct everything that apache don't recognize or if an index file doesn't exist then it is forwarded to tomcat.
    This would solve my problem whit jsf. So any help in how to get it to work is appreciated.

    /ripit
     
  5. ripit

    ripit New Member

    Hi again

    I think I solved it but not with JkOptions ForwardDirectories because I didn't know how.

    I do:

    Code:
    DirectoryIndex index.html index.php *.jsp
    and then i forward all jsp to tomcat with this:

    Code:
    JkMount /*.jsp worker1
    and then I have to stop access to WEB-INF directory like this:

    Code:
    <Directory ~ "/WEB-INF" >
        AllowOverride None
        Deny from all
    </Directory>
    This seems to solve my problems with JSF.

    If anyone got any other suggestions or know about any security issues with this solution I would be glad to know about them.

    Thanks in advance

    /ripit
     

Share This Page