[opencms-dev] OpenCMS/Apache access via IP?

Oliver Berse oliver.berse at snsconsulting.de
Tue Sep 22 17:19:28 CEST 2009


Hi all,

we have some OpenCMS (6.2, Tomcat ROOT-WebApp) sites running on our 
server. Each site is configured as a virtual host in Apache.

Our goal: a new site (SITE_B) should be accessible only by the servers 
IP, so that a client can view the site without log-in and any knowledge 
of OpenCMS.                                                         

Problem: the new vhost does not have any effects, SITE_B is not 
accessible via IP. Instead the IP leads to an older Site (SITE_A) with 
another vhost.

The vhosts for SITE_A & SITE_B in httpd.conf:
============================================

<VirtualHost SERVER_IP:80>
  DocumentRoot "/etc/opencms/apache-tomcat-5.5.20/webapps/ROOT/"   
  ServerName www.SITE_A.com
  ServerAlias www.SITE_A.de

  <Directory "/etc/opencms/apache-tomcat-5.5.20/webapps/ROOT">
        Order allow,deny
       Allow from all
  </Directory>

  # Log only non-redirect requests in "normal" log file
  SetEnvIf Request_URI "\/opencms\/*" redirect

  RewriteEngine     on
  RewriteCond %{REQUEST_URI} ^/export/(.*) [NC]
  RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
  RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
  RewriteRule .* 
http://127.0.0.1:8081/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]

  ProxyPass           /opencms/       !
  RedirectPermanent   /opencms/       http://SERVER_IP/
  ProxyPass           /system/login   !
  RedirectPermanent   /system/login   http://SERVER_IP/
  ProxyPass           /resources/     !
  ProxyPass           /export/        !
  ProxyPass          /disclaimer/    !

  ProxyPass           /                               
http://127.0.0.1:8081/opencms/
  ProxyPassReverse    /                               
http://127.0.0.1:8081/opencms/

  CustomLog "|/usr/sbin/cronolog /var/log/httpd/SITE_A/access.log_%Y%m" 
combined
  ErrorLog "|/usr/sbin/cronolog /var/log/httpd/SITE_A/error.log_%Y%m"
 
  #CustomLog "/etc/httpd/logs/SITE_A/access.log" combined
  #ErrorLog "/etc/httpd/logs/SITE_A/error.log"
 
</VirtualHost>

<VirtualHost SERVER_IP:80>
  DocumentRoot "/etc/opencms/apache-tomcat-5.5.20/webapps/ROOT/"
  ServerName SITE_B
  ServerAlias SERVER_IP

  <Directory "/etc/opencms/apache-tomcat-5.5.20/webapps/ROOT">
        Order allow,deny
       Allow from all
  </Directory>

  # Log only non-redirect requests in "normal" log file
  SetEnvIf Request_URI "\/opencms\/*" redirect

  RewriteEngine     on
  RewriteCond %{REQUEST_URI} ^/export/(.*) [NC]
  RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
  RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
  RewriteRule .* 
http://127.0.0.1:8092/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P]

  ProxyPass           /opencms/       !
  RedirectPermanent   /opencms/       http://SITE_B/
  ProxyPass           /system/login   !
  RedirectPermanent   /system/login   http://www.SITE_B/
  ProxyPass           /resources/     !
  ProxyPass           /export/        !

  ProxyPass           /                               
http://127.0.0.1:8092/opencms/
  ProxyPassReverse    /                               
http://127.0.0.1:8092/opencms/

  CustomLog "|/usr/sbin/cronolog 
/var/log/httpd/www.SITE_B/access.log_%Y%m" combined
  ErrorLog "|/usr/sbin/cronolog /var/log/httpd/www.SITE_B/error.log_%Y%m"

</VirtualHost>

In open-cms-system.xml:
=======================

<site server="http://SITE_A" uri="/sites/SITE_A/">               
    <alias server="http://alias_for_site_a"/>
</site>

<site server="http://SITE_B" uri="/sites/SITE_B/">
    <alias server="http://SERVER_IP"/>
</site>

Any hints?

best regards,
Oliver





More information about the opencms-dev mailing list