logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache home, Tomcat and mod_ajp
Author
Ice



Joined: 09 Sep 2013
Posts: 3
Location: UK

PostPosted: Mon 09 Sep '13 15:36    Post subject: Apache home, Tomcat and mod_ajp Reply with quote

I'm probably going to kick myself at some obvious answer to this, but I've been trying several options for a couple of days and failing miserably.

I've got a CentOS 6u3 64-bit machine running Jenkins, and other apps, under tomcat 6.

I've been happily re-directing to the tomcat servlets using the vhosts.conf file as follows (only showing Jenkins):

Code:
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName jenkins.host.tld
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / ajp://127.0.0.1:8009/
  ProxyPassReverse / ajp://127.0.0.1:8009/
  ProxyPassReverseCookiePath /jenkins /
</VirtualHost>


i.e. <server>/jenkins gets redirected to <server>:8080/jenkins

I now need to add an apache website <server>, but can't get it configured to display <server>/index.html.

If I remove vhosts.conf and restart apache then I do get to see <server>/index.html. I've tried many options for vhosts.conf to get this to work but I either end up with the index.html and no servlets, or the servlets and no index.html.

Sorry that this seems such a trivial configuration problem but I'm tearing my hair out. Think I'm missing something obvious.

Any solutions? Please be gentle and spell it out!

Thanks.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 09 Sep '13 16:10    Post subject: Reply with quote

If you got you right, you wann have / = normal webserver and /jenkins/ to jenkins 8009

Code:

<VirtualHost *:80>
    ServerName jenkins
    DocumentRoot "/mario/Apache22/htdocs"
    <Directory "/mario/Apache22/htdocs">
        Options Indexes Includes FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Deny from none
    </Directory>
    <Location /jenkins>
        ProxyPass ajp://localhost:8009/
        ProxyPassReverse ajp://localhost:8009/
    </Location>
</virtualhost>
Back to top
Ice



Joined: 09 Sep 2013
Posts: 3
Location: UK

PostPosted: Mon 09 Sep '13 17:10    Post subject: Reply with quote

Yes, I saw that one and thought that was a solution
Code:

NameVirtualHost *:80


<VirtualHost *:80>
    ServerName aserver
    DocumentRoot "/var/www/html"
    <Directory "/var/www/html">
        Options Indexes Includes FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Deny from none
    </Directory>
    <Location /jenkins>
        ProxyPass ajp://127.0.0.1:8009/
        ProxyPassReverse ajp://127.0.0.1:8009/
    </Location>
</VirtualHost>


That gets me the aserver/, but not the redirection to aserver:8080/jenkins from aserver/jenkins

From my original post

Code:
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName jenkins.host.tld
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / ajp://127.0.0.1:8009/
  ProxyPassReverse / ajp://127.0.0.1:8009/
  ProxyPassReverseCookiePath /jenkins /
</VirtualHost>

<VirtualHost *:80>
  ServerName sonar.host.tld
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / ajp://127.0.0.1:8009/
  ProxyPassReverse / ajp://127.0.0.1:8009/
  ProxyPassReverseCookiePath /sonar /
</VirtualHost>


Gets me /sonar and /jenkins (I have other servlets), but not /. I'm missing the appropriate 're-direction' to the basic apache server.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 09 Sep '13 18:06    Post subject: Reply with quote

I'm a bit confused or lost in translation. So you may show what should do what like
Code:

jenkins.host.tld --> AJP 127.0.0.1 8009 /jenkins
sonar.host.tld --> AJP 127.0.0.1 8009 /sonar
default vhost --> document root


??

by the way there is no port 8080 in your config ( Yes I know that the tomcat listens to 8080 with http and AJP on port 8009).
Back to top
Ice



Joined: 09 Sep 2013
Posts: 3
Location: UK

PostPosted: Mon 09 Sep '13 18:16    Post subject: Reply with quote

Yes, that's it

Code:
aserver/jenkins -> AJP 127.0.0.1:8009 /jenkins
aserver/sonar   -> AJP 127.0.0.1:8009 /sonar
aserver         -> document root


Re 8080 - I was providing the description from the POV of the user of the browser, not what's going on underneath.

I suspect that I've been too enthusiastic with
<VirtualHost *:80> and have the problem that the original solution worked, even if it wasn't the most efficient solution.

and I don't understand what jenkins.host.tld is actually doing for me
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 10 Sep '13 10:43    Post subject: Reply with quote

Code:

<VirtualHost *:80>
    ServerName aserver
    DocumentRoot "/var/www/html"
    <Directory "/var/www/html">
        Options Indexes Includes FollowSymLinks
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Deny from none
    </Directory>
    <Location /jenkins>
        ProxyPass ajp://localhost:8009/jenkins
        ProxyPassReverse ajp://localhost:8009/jenkins
    </Location>
    <Location /sonar>
        ProxyPass ajp://localhost:8009/sonar
        ProxyPassReverse ajp://localhost:8009/sonar
    </Location>
</virtualhost>


Ice wrote:

and I don't understand what jenkins.host.tld is actually doing for me


It is to access the jenkins directly via a different server name without the directory.
Back to top


Reply to topic   Topic: Apache home, Tomcat and mod_ajp View previous topic :: View next topic
Post new topic   Forum Index -> Apache