[Solved] RE: Request for assistance with OpenCms and Apache configuration on Tomcat

Ramon Gavira Sáenz via opencms-dev <[email protected]>
Newsgroups gmane.comp.cms.opencms.devel
Message-ID <AS8PR05MB8502FD924A660387DC65235EE2999@AS8PR05MB8502.eurprd05.prod.outlook.com>
I finally found out the solution:

Here is the solution for an installation on webapps/opencms2


<VirtualHost *:443>

    ServerName domain.example.com

    ServerAlias domain.alias.example.com



    ServerAdmin webmaster@ domain.example.com <mailto:[email protected]>



    # 1. Use the webapp's home as document root

    DocumentRoot /var/lib/tomcat9/webapps/opencms2



    # 2. Allow Apache to access the export and resources folders directly

    <Directory /var/lib/tomcat9/webapps/opencms2/export>

        Options FollowSymlinks

        Order Deny,Allow

        Allow from all

        Satisfy any

    </Directory>



    <Directory /var/lib/tomcat9/webapps/opencms2/resources>

        Options FollowSymlinks

        Order Deny,Allow

        Allow from all

        Satisfy any

    </Directory>



    # 3. Set logging behavior (optional)

      ErrorLog /var/log/apache2/opencms2.error.log

      CustomLog /var/log/apache2/opencms2.access.log combined

      LogLevel trace3





    # SSL Certificates

    SSLCertificateFile /etc/letsencrypt/live/cert/cert.pem

    SSLCertificateKeyFile /etc/letsencrypt/live/cert/privkey.pem

    Include /etc/letsencrypt/options-ssl-apache.conf

    SSLCertificateChainFile /etc/letsencrypt/live/cert/chain.pem





    # 4. Enable rewriting

    RewriteEngine On

    ProxyPreserveHost On







    # 5. (Optional) Deny access to PHP files

    RewriteCond %{REQUEST_FILENAME} (.+)\.php(.*)

    RewriteRule (.*) / [F]





    # 6. Add opencms/ prefix if required

    RewriteCond %{REQUEST_URI} !^/opencms2/workplace.*$

    RewriteCond %{REQUEST_URI} !^/opencms2/VAADIN/.*$

    RewriteCond %{REQUEST_URI} !^/opencms2/resources/.*$

    RewriteCond %{REQUEST_URI} !^/export/.*$

    RewriteCond %{REQUEST_URI} !^/opencms2/webdav.*$

    RewriteRule !^/opencms2/opencms/(.*)$ /opencms2/opencms%{REQUEST_URI} [PT]



    # 7. Rewrite rule to make OpenCms' static export working

    RewriteCond %{REQUEST_URI} ^/export/.*$

    RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f

    RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f

    RewriteRule .* /handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [PT]





    # 8. Connect to Tomcat using proxy_ajp

    ProxyPass /handle404  ajp://localhost:8009/opencms2/handle404

    ProxyPass /opencms2/opencms ajp://localhost:8009/opencms2/opencms

    ProxyPass /opencms2/webdav(.*) ajp://localhost:8009/opencms2/webdav$1

    ProxyPass /opencms2/VAADIN ajp://localhost:8009/opencms2/VAADIN

    ProxyPass /opencms2/workplace ajp://localhost:8009/opencms2/workplace





</VirtualHost>



De: opencms-dev <[email protected]> En nombre de Ramon Gavira Sáenz via opencms-dev
Enviado el: miércoles, 12 de abril de 2023 11:53
Para: [email protected]
CC: Ramon Gavira Sáenz <[email protected]>
Asunto: [opencms-dev] Request for assistance with OpenCms and Apache configuration on Tomcat

I am in need of assistance with configuring two instances of OpenCms on the same Tomcat server, using Apache as the web server. The Apache proxy configuration described in the OpenCms Documentation Site (Apache proxy configuration (opencms.org)<https://documentation.opencms.org/opencms-documentation/server-administration/apache-proxy-configuration/index.html>) assumes that OpenCms is installed as the ROOT application in Tomcat.

Has anyone had experience configuring a proxy for an OpenCms installation that is not the ROOT application, using Proxy AJP to remove the /opencms/opencms/ context path?

This task is driving me crazy and any help would be greatly appreciated.

Best regards,

Ramón Gavira Sáenz

_______________________________________________
This mail is sent to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
https://lists.opencms.org/mailman/listinfo/opencms-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.