[opencms-dev] Links and multi-site setups?

Bernd Wolfsegger bw at code-create.com
Sat Mar 26 12:44:10 CET 2005


Hi,

have a look at the configuration below.
Works very well for me and as it seems for others too.
Becaus the thing described on the "multi site howto" does not work properly for many reasons I mentionend in an older post.
The other generell thing is, that the generated paths are differnt calling a side when logged in or when not logged in. So, if you use literal paths in your code you have to make sure, that the correct "root" path is used.
For your site it is "/" when you are NOT logged in and "/sites/mysite/" when you are logged in .... 

Kind regards, Bernd

A working solution is the one below (usingTomcat 5.0.19-13, Apache 2.0.49-27.18.3, MySql 4.0.18-32.9) on SuSE Linux 9.1:
Install OpenCms normally as described.
The pathfragment "/opencms/opencms" will still be there,
but there has to be only a new property in the OpenCms configuration files, where you can select if you want this "/opencms/opencms/" and "/opencms/" or not, because you don't need it in the urls, when you set all as described below.

www.mysite.com is a site
opencms.mysite.com is the OpenCms workspace.

server.xml:
        <!-- Define one connector for opencms.mysite.com -->
        <Connector port="8081" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
            proxyName="opencms.mysite.com" proxyPort="80"
            enableLookups="true" redirectPort="8443"
            acceptCount="100" debug="0" connectionTimeout="20000"
            disableUploadTimeout="true" />
 
        <!-- Define one connector for www.mysite.com -->
        <Connector port="8082" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
            proxyName="www.mysite.com" proxyPort="80"
            enableLookups="true" redirectPort="8443"
            acceptCount="100" debug="0" connectionTimeout="20000"
            disableUploadTimeout="true" />



Virtualhost directiven in der Apache Konfiguration:
<VirtualHost 192.168.0.100:80>
    ServerName opencms.mysite.com
    ServerAdmin bw at mysite.com
    DocumentRoot "/srv/www/tomcat/developer/webapps/"
    ErrorLog /var/log/apache2/opencms/error_log
  # Log only non-redirect requests in "normal" log file
  SetEnvIf Request_URI "\/opencms\/*" redirect
        CustomLog /var/log/apache2/opencms/access_log common env=!redirect
        CustomLog /var/log/apache2/opencms/referer_log referer env=!redirect
        CustomLog /var/log/apache2/opencms/agent_log agent env=!redirect
    

        <Directory "/srv/www/tomcat/developer/webapps/">

        AllowOverride All
        Order allow,deny
        Allow from all

        </Directory>

    ProxyPass         /opencms/export/        http://localhost:8081/opencms/export/
    ProxyPassReverse  /opencms/export/        http://localhost:8081/opencms/export/
    ProxyPass         /opencms/resources/     http://localhost:8081/opencms/resources/
    ProxyPassReverse  /opencms/resources/     http://localhost:8081/opencms/resources/
    ProxyPass         /opencms/opencms/       http://localhost:8081/opencms/opencms/
    ProxyPassReverse  /opencms/opencms/       http://localhost:8081/opencms/opencms/
    ProxyPass         /opencms/                         http://localhost:8081/opencms/opencms/
    ProxyPassReverse  /opencms/                         http://localhost:8081/opencms/opencms/
    ProxyPass         /                                             http://localhost:8081/opencms/opencms/
    ProxyPassReverse  /                                             http://localhost:8081/opencms/opencms/

    
</VirtualHost>

<VirtualHost 192.168.0.100:80>
    ServerName www.mysite.com
    ServerAdmin bw at mysite.com
    DocumentRoot "/srv/www/tomcat/developer/webapps/"
    ErrorLog /var/log/apache2/opencms/www_error_log
  # Log only non-redirect requests in "normal" log file
  SetEnvIf Request_URI "\/opencms\/*" redirect
        CustomLog /var/log/apache2/opencms/www_access_log common env=!redirect
        CustomLog /var/log/apache2/opencms/www_referer_log referer env=!redirect
        CustomLog /var/log/apache2/opencms/www_agent_log agent env=!redirect
    

        <Directory "/srv/www/tomcat/developer/webapps/">

        AllowOverride All
        Order allow,deny
        Allow from all

        </Directory>

    ProxyPass         /opencms/export/       http://localhost:8082/opencms/export/
    ProxyPassReverse  /opencms/export/       http://localhost:8082/opencms/export/
    ProxyPass         /opencms/resources/       http://localhost:8082/opencms/resources/
    ProxyPassReverse  /opencms/resources/       http://localhost:8082/opencms/resources/
    ProxyPass         /opencms/opencms/       http://localhost:8082/opencms/opencms/
    ProxyPassReverse  /opencms/opencms/       http://localhost:8082/opencms/opencms/
    ProxyPass         /opencms/                         http://localhost:8082/opencms/opencms/
    ProxyPassReverse  /opencms/                         http://localhost:8082/opencms/opencms/
    ProxyPass         /                                             http://localhost:8082/opencms/opencms/
    ProxyPassReverse  /                                             http://localhost:8082/opencms/opencms/

</VirtualHost>



opencms-system.xml:
        <sites>
            <workplace-server>http://opencms.mysite.com</workplace-server>
            <default-uri>/sites/default/</default-uri>
            <site server="http://opencms.mysite.com" uri="/sites/default/"/>
            <site server="http://www.mysite.com" uri="/sites/mysite/"/>
        </sites>



opencms_importexport.xml:
                <rendersettings>
                        <rfs-prefix>${CONTEXT_NAME}/export</rfs-prefix>
                        <vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix>
                        <userelativelinks>false</userelativelinks>                      
                        <exporturl>http://opencms.mysite.com${CONTEXT_NAME}/handle404</exporturl>
                        <plainoptimization>true</plainoptimization>
                        <testresource uri="/system/shared/page.dtd"/>
                        <resourcestorender>
                                <regex>/sites/.*</regex>
                                <regex>/system/galleries/.*</regex>
                                <regex>/system/modules/.*/resources/.*</regex>
                        </resourcestorender>
                </rendersettings>


On Thursday 24 March 2005 18:45, Barry wrote:
> Hi All,
>
>
>
> I can't seem to get links to behave when setting up multi-site stuff. The
> initial page loads OK, but any generated link in the page tend to point to
>
>
>
> http://www.mysite.com/opencms/sites/my/site/link.html
>
>
>
> Instead of the desired behaviour of:
>
>
>
> http://www.mysite.com/link.html
>
>
>
> This means that links in my pages don't work.
>
>
>
> I've set everything up as described in the how-to-multi-site description in
> the documentation but its still not behaving.
>
>
>
> Does anyone know how to fix this?
>
>
>
> Regards, Barry.



More information about the opencms-dev mailing list