Apache Proxy on Tomcat AJP not Working
Asked by Claudio Cesar:

Hello everyone, everything good ? I'm new here. I'm installing dspace 6.3 on Centos 7.9, I don't know the application. I made it work on localhost address:8080/xmlui  
But I need it working on the mydomain.com URL on port 80.  
I configured apache server 2.4 with reverse proxy enabling the AJP module and connector on 8009 in tomcat. But he did not access the application and is returning the error:

"Service Unavailable  
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later."

I would like to know how I configure and point apache in the parameter "DocumentRoot"  
Follow my mydomain.cond by apache   

\<VirtualHost \*:80\>  
ServerName rmydomain.com

ServerSignature off  
ProxyPass /ignored_path !  
ProxyPass "/" ajp://127.0.0.1:8009/  
ProxyPassReverse "/" ajp://127.0.0.1:8009/

\<Directory /opt/tomcat/\>  
Options FollowSymlinks  
AllowOverride All  
Options -Multiviews  
\</Directory\>  
#RewriteEngine On  
#RewriteCond %{REQUEST_METHOD} \^(TRACE\|TRACK)  
#RewriteRule .\* - \[F\]  
\</VirtualHost\>

\<VirtualHost \*:80\>  
ServerName mydomain1.com  
# DocumentRoot /dspace/www/  
DocumentRoot /dspace/webapps  
RewriteEngine On  
RewriteCond %{REQUEST_METHOD} \^(TRACE\|TRACK)  
RewriteRule .\* - \[F\]  
\</VirtualHost\>

As you see, i set the DocumentRoot to /dspace/webapps. But i do not know if is right.

Follow my /etc/httpd/conf/httpd.conf

\<VirtualHost \*:443\>  
ServerName mydomain.com  
ServerAlias subdomain.mydomain  

ServerSignature off  
ProxyPass /ignored_path !  
ProxyPass "/" ajp://127.0.0.1:8009/  
ProxyPassReverse "/" ajp://127.0.0.1:8009/

\<Directory /opt/tomcat/\>  
Options FollowSymlinks  
AllowOverride All  
Options -Multiviews  
\</Directory\>  
## SSL configuration  
SSLEngine on

## UPDATE to point to location of your certificate files !  
SSLCACertificateFile /etc/httpd/ssl/mydomain.ca-bundle  
SSLCertificateFile /etc/httpd/ssl/mydomain.crt  
SSLCertificateKeyFile /etc/httpd/ssl/rmydomain.key  
SSLCertificateChainFile /etc/httpd/ssl/mydomain.csr

SSLProtocol ALL -SSLv2 -SSLv3  
SSLHonorCipherOrder On  
SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS

ErrorLog /var/log/httpd/ssl_error_log  
CustomLog /var/log/httpd/ssl_access_log common  
RewriteEngine On  
RewriteCond %{REQUEST_METHOD} \^(TRACE\|TRACK)  
RewriteRule .\* - \[F\]  
\</VirtualHost\>

my server.xml

\<!-- You should set jvmRoute to support load-balancing via AJP ie :  
\<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1"\>  
--\>  
\<Engine name="Catalina" defaultHost="localhost"\>

\<!--For clustering, please take a look at documentation at:  
/docs/cluster-howto.html (simple how to)  
/docs/config/cluster.html (reference documentation) --\>  
\<!--  
\<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/\>  
--\>

\<!-- Use the LockOutRealm to prevent attempts to guess user passwords  
via a brute-force attack --\>  
\<Realm className="org.apache.catalina.realm.LockOutRealm"\>  
\<!-- This Realm uses the UserDatabase configured in the global JNDI  
resources under the key "UserDatabase". Any edits  
that are performed against this UserDatabase are immediately  
available for use by the Realm. --\>  
\<Realm className="org.apache.catalina.realm.UserDatabaseRealm"  
resourceName="UserDatabase"/\>  
\</Realm\>

\<Host name="localhost" appBase="webapps"  
unpackWARs="true" autoDeploy="true"\>

\<!-- SingleSignOn valve, share authentication between web applications  
Documentation at: /docs/config/valve.html --\>  
\<!--  
\<Valve className="org.apache.catalina.authenticator.SingleSignOn" /\>  
--\>

\<!-- Access log processes all example.  
Documentation at: /docs/config/valve.html  
Note: The pattern used is equivalent to using pattern="common" --\>  
\<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"  
prefix="localhost_access_log" suffix=".txt"  
pattern="%h %l %u %t \&quot;%r\&quot; %s %b" /\>

\</Host\>  
\</Engine\>  
\</Service\>  
\</Server\>


Answers:
author: Nic Brough -Adaptavist-
body: I suspect you might be asking in the wrong place. This does not look like a question related to Atlassian's Confluence. I suspect you've clicked on "Help with Confluence" (which is what Apache use for documenting some projects), rather than "Help with Tomcat/dspace"


Tags: apache

confluence-server

proxy

server