Skip to end of metadata
Go to start of metadata

Step-by-step guide

Three files modification

  1. confluence/pages/viewpreviousversions.vm - to disable public page history view
  2. bin/setenv.sh - to give more memory
  3. conf/server.xml - to properly work behind Apache with SSL 


confluence/pages/viewpreviousversions.vm
#* @vtlvariable name="action" type="com.atlassian.confluence.pages.actions.ViewPreviousVersionsAction" *#
#* @vtlvariable name="allVersions" type="java.util.List<com.atlassian.confluence.core.VersionHistorySummary>" *#
#* @vtlvariable name="contributor" type="com.atlassian.user.User" *#

#macro(contributorAvatarAndName $contributor)
    #if ($contributor && $contributor != "")
        #set ($userProfilePicture = $userAccessor.getUserProfilePicture($contributor))
        <a class="page-history-contributor-link"
           data-username="$contributor.name"
           #if (!$userProfilePicture.isAnonymousPicture())href="$req.contextPath/display/~$contributor.name"#end
        >
            <img class="page-history-contributor-profile-pic" src="$userProfilePicture.uriReference"/>
            <span class="page-history-contributor-name">$contributor.getFullName()</span>
        </a>
    #else
    <a class="page-history-contributor-link">
        <img class="page-history-contributor-profile-pic" src="$staticResourceUrlPrefix/images/icons/profilepics/anonymous.svg"/>
        <span class="page-history-contributor-name">$action.getText("user.icon.anonymous.title")</span>
    </a>
    #end
#end

#macro(additionalContributorsDialog $additionalContributors $page)
    #if ($additionalContributors.size() > 0)
    <button class="aui-button additional-contributors-button" aria-controls="additional-contributors-$page.id" data-aui-trigger="true">$additionalContributors.size()</button>
    <span class="aui-button aui-button-link additional-contributors-button" aria-controls="additional-contributors-$page.id" data-aui-trigger="true">
        #if($additionalContributors.size() == 1)
            $action.getText("view.previous.versions.additional.contributors.one")
        #else
            $action.getText("view.previous.versions.additional.contributors", $additionalContributors.size())
        #end
    </span>
    <aui-inline-dialog id="additional-contributors-$page.id"
                       alignment="top left"
                       responds-to="toggle"
                       aria-hidden="true">
        <div class="page-history-additional-contributors-dialog-content">
            #foreach ( $additionalContributor in $additionalContributors)
                <div class="additional-contributor-row">
                    #if ($additionalContributor && $additionalContributor != "")
                        #set ($userProfilePicture = $userAccessor.getUserProfilePicture($additionalContributor))
                        <a class="page-history-additional-contributor-link"
                           data-username="$additionalContributor.name"
                           href="$req.contextPath/display/~$additionalContributor.name">
                            <img class="page-history-additional-contributor-profile-pic" src="$userProfilePicture.uriReference"/>
                            <span class="page-history-additional-contributor-name">$additionalContributor.fullName</span>
                        </a>
                    #else
                        <a class="page-history-additional-contributor-link">
                            <img class="page-history-additional-contributor-profile-pic" src="$staticResourceUrlPrefix/images/icons/profilepics/anonymous.svg"/>
                            <span class="page-history-additional-contributor-name">$action.getText("user.icon.anonymous.title")</span>
                        </a>
                    #end
                </div>
            #end
        </div>
    </aui-inline-dialog>
    #end
#end

<html>
    <head>
        <title>$action.getText("title.view.previous.versions")#if($page.title) - $page.title#end</title>
    </head>

    <content tag="title-text-span">$action.getText("title.view.previous.versions")</content>

    #applyDecorator("root")
        #decoratorParam("helper" $action.helper)
        #decoratorParam("mode" "view-information")
        #decoratorParam("calendar-width" "200px")
        #decoratorParam("context" "$action.page.type")

        #if ($action.remoteUser != $null)

        #requireResource("confluence.web.resources:page-history")
        <form name="diff" method="GET" action="diffpagesbyversion.action" class="aui">

            <input type="submit" class="aui-button" value="$action.getText('compare.selected')">
            <input type="hidden" name="pageId" value="$action.pageId">

            <style>
            .tableview td {white-space:nowrap; vertical-align:top;}
            </style>

            <table id="page-history-container" width="100%" cellspacing="0" class="aui tableview">
                <thead>
                    <tr>
                        <th>&nbsp;</th>
                        <th>$action.getText("heading.version.number")</th>
                        <th>$action.getText("heading.version.date")</th>
                        <th>$action.getText("heading.contributors")</th>
                        <th>$action.getText("heading.comment")</th>
                        <th>$action.getText("heading.actions")</th>
                    </tr>
                </thead>
                <tbody>
                    #foreach( $pageVersion in $allVersions )
                        <tr id="rowForVersion$pageVersion.version">
                            <td width="%1"><input type="checkbox" name="selectedPageVersions" value="$pageVersion.version" #if ($action.isSelectedVersion($pageVersion.version)) checked #end></td>
                            ## Version
                            <td align="left">
                                #if ($velocityCount == 1)
                                    <strong>
                                        <a href="viewpage.action?pageId=$page.id">$action.getText("current.version")</a>
                                        (v. $page.version)
                                    </strong>
                                #else
                                    <a class="view-historical-version-trigger" href="viewpage.action?pageId=${pageVersion.id}">v. $pageVersion.version</a>
                                #end
                            </td>
                            ## Last modification date
                            <td align="middle" #if($velocityCount == 1)  style="font-weight: bold;" #end>
                                $dateFormatter.formatDateTime( $pageVersion.lastModificationDate )
                            </td>
                            ## Contributors
                            <td class="contributors" style="white-space: normal;">
                                #if ($darkFeatures.isDarkFeatureEnabled("collaborative-audit-log"))
                                    #set ($additionalContributors = [])
                                    #set ($maxContributors = 12)
                                    #set ($contributors = $pageVersion.getContributorSet())
                                    #foreach( $contributor in $contributors )
                                        #if ($contributors.size() > $maxContributors && $velocityCount > $maxContributors)
                                            #set ($dummy = $additionalContributors.add($contributor))
                                        #else
                                            #contributorAvatarAndName($contributor)
                                        #end
                                    #end
                                    #additionalContributorsDialog($additionalContributors $pageVersion)
                                #else
                                    <strong>#userLink ($pageVersion.lastModifier)</strong>
                                #end
                            </td>
                            ## Version comment
                            <td>
                                #if ($pageVersion.versionCommentAvailable)
                                    <span class="change-comment">$pageVersion.renderedVersionComment</span>
                                #end
                            </td>
                            ## Actions
                            #if ($velocityCount == 1)
                                <td>&nbsp;</td> ## No operations can be performed on the latest version
                            #else
                                <td align="middle">
                                    #if ($action.isRevertPermitted())
                                        #if ($pageVersion.version > 0)
                                            <a class="restore-historical-version-trigger" href="revertpagebacktoversion.action?pageId=$page.id&version=${pageVersion.version}">$action.getText("restore.this.version")</a>
                                        #end
                                    #end
                                    #if ($action.isRemoveHistoricalVersionPermitted())
                                        &nbsp;&nbsp;<a class="remove-historical-version-trigger" data-pageid="$pageVersion.id" data-version="$pageVersion.version" href="#">$action.getText("remove.name")</a>
                                    #end
                                </td>
                            #end
                        </tr>
                    #end
                </tbody>
            </table>
        </form>
        <form id="remove-historical-version-form" name="removehistoricalversion" method="POST" action="removehistoricalversion.action" class="hidden">
            #form_xsrfToken()
            <input id="remove-historical-version-pageid" type="hidden" name="pageId" value="" />
            <input id="remove-historical-version-content-type" type="hidden" name="contentType" value="$action.page.type" />
        </form>
        <p><a href="${req.contextPath}/pages/viewinfo.action?pageId=${page.id}" class="aui-button aui-button-link">$action.getText('return.to.page.info')</a></p>
        #else
           <ul>Unfortunately, as an anonymous user you do not have permission to view page history. For further information please contact your Confluence Administrator.</ul>
        #end
    #end
</html>




bin/setenv.sh
# See the CATALINA_OPTS below for tuning the JVM arguments used to start Confluence.

echo "If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide"

# set the location of the pid file
if [ -z "$CATALINA_PID" ] ; then
    if [ -n "$CATALINA_BASE" ] ; then
        CATALINA_PID="$CATALINA_BASE"/work/catalina.pid
    elif [ -n "$CATALINA_HOME" ] ; then
        CATALINA_PID="$CATALINA_HOME"/work/catalina.pid
    fi
fi
export CATALINA_PID

PRGDIR=`dirname "$0"`
if [ -z "$CATALINA_BASE" ]; then
  if [ -z "$CATALINA_HOME" ]; then
    LOGBASE=$PRGDIR
    LOGTAIL=..
  else
    LOGBASE=$CATALINA_HOME
    LOGTAIL=.
  fi
else
  LOGBASE=$CATALINA_BASE
  LOGTAIL=.
fi

PUSHED_DIR=`pwd`
cd $LOGBASE
cd $LOGTAIL
LOGBASEABS=`pwd`
cd $PUSHED_DIR

echo ""
echo "Server startup logs are located in $LOGBASEABS/logs/catalina.out"
# IMPORTANT NOTE: Only set JAVA_HOME or JRE_HOME above this line
# Get standard Java environment variables
if $os400; then
  # -r will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  . "$CATALINA_HOME"/bin/setjre.sh
else
  if [ -r "$CATALINA_HOME"/bin/setjre.sh ]; then
    . "$CATALINA_HOME"/bin/setjre.sh
  else
    echo "Cannot find $CATALINA_HOME/bin/setjre.sh"
    echo "This file is needed to run this program"
    exit 1
  fi
fi

echo "---------------------------------------------------------------------------"
echo "Using Java: $JRE_HOME/bin/java"
CONFLUENCE_CONTEXT_PATH=`$JRE_HOME/bin/java -jar $CATALINA_HOME/bin/confluence-context-path-extractor.jar $CATALINA_HOME`
export CONFLUENCE_CONTEXT_PATH
$JRE_HOME/bin/java -jar $CATALINA_HOME/bin/synchrony-proxy-watchdog.jar $CATALINA_HOME
echo "---------------------------------------------------------------------------"

# Set the JVM arguments used to start Confluence. For a description of the options, see
# http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
CATALINA_OPTS="-XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution ${CATALINA_OPTS}"
CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}"
CATALINA_OPTS="-XX:G1ReservePercent=20 ${CATALINA_OPTS}"
CATALINA_OPTS="-Djava.awt.headless=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Datlassian.plugins.enable.wait=300 ${CATALINA_OPTS}"
CATALINA_OPTS="-Xms2048m -Xmx2048m -XX:+UseG1GC ${CATALINA_OPTS}"
CATALINA_OPTS="-Dsynchrony.enable.xhr.fallback=true ${CATALINA_OPTS}"
CATALINA_OPTS="-Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 ${CATALINA_OPTS}"
CATALINA_OPTS="${START_CONFLUENCE_JAVA_OPTS} ${CATALINA_OPTS}"
CATALINA_OPTS="-Dconfluence.context.path=${CONFLUENCE_CONTEXT_PATH} ${CATALINA_OPTS}"
CATALINA_OPTS="-XX:ReservedCodeCacheSize=256m -XX:+UseCodeCacheFlushing ${CATALINA_OPTS}"


export CATALINA_OPTS



conf/server.xml
<Server port="8000" shutdown="SHUTDOWN" debug="0">
    <Service name="Tomcat-Standalone">
        <!--
         ==============================================================================================================
         DEFAULT - Direct connector with no proxy, for unproxied HTTP access to Confluence.

         If using a http/https proxy, comment out this connector.
         ==============================================================================================================
        -->
        <!--
        <Connector port="8090" connectionTimeout="20000" redirectPort="8443"
                   maxThreads="48" minSpareThreads="10"
                   enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
                   protocol="org.apache.coyote.http11.Http11NioProtocol"/>
        -->
        <!--
         ==============================================================================================================
         HTTP - Proxying Confluence via Apache or Nginx over HTTP

         If you're proxying traffic to Confluence over HTTP, uncomment the connector below and comment out the others.
         Make sure you provide the right information for proxyName and proxyPort.

         For more information see:
            Apache - https://confluence.atlassian.com/x/4xQLM
            nginx  - https://confluence.atlassian.com/x/TgSvEg

         ==============================================================================================================
        -->

        <!--
        <Connector port="8090" connectionTimeout="20000" redirectPort="8443"
                   maxThreads="48" minSpareThreads="10"
                   enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
                   protocol="org.apache.coyote.http11.Http11NioProtocol"
                   scheme="http" proxyName="<subdomain>.<domain>.com" proxyPort="80"/>
        -->

        <!--
         ==============================================================================================================
         HTTPS - Direct connector with no proxy, for unproxied HTTPS access to Confluence.

         For more info see https://confluence.atlassian.com/x/s3UC
         ==============================================================================================================
        -->

        <!--
        <Connector port="8443" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25"
                   protocol="org.apache.coyote.http11.Http11NioProtocol"
                   enableLookups="false" disableUploadTimeout="true"
                   acceptCount="100" scheme="https" secure="true"
                   clientAuth="false" sslProtocol="TLSv1.2" sslEnabledProtocols="TLSv1.2" SSLEnabled="true"
                   URIEncoding="UTF-8" keystorePass="<MY_CERTIFICATE_PASSWORD>"/>
        -->

        <!--
         ==============================================================================================================
         HTTPS - Proxying Confluence via Apache or Nginx over HTTPS

         If you're proxying traffic to Confluence over HTTPS, uncomment the connector below and comment out the others.
         Make sure you provide the right information for proxyName and proxyPort.

         For more information see:
            Apache - https://confluence.atlassian.com/x/PTT3MQ
            nginx  - https://confluence.atlassian.com/x/cNIvMw
         ==============================================================================================================
        -->


        <Connector port="8090" connectionTimeout="20000" redirectPort="8443"
                   maxThreads="48" minSpareThreads="10"
                   enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
                   protocol="org.apache.coyote.http11.Http11NioProtocol"
                   scheme="https" proxyName="fido.e-utp.net" proxyPort="443"/>


        <Engine name="Standalone" defaultHost="localhost" debug="0">
            <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4">
                <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
                    <!-- Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
                    <Manager pathname=""/>
                    <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/>
                </Context>

                <Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0"
                         reloadable="false" useHttpOnly="true">
                    <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/>
                </Context>
            </Host>
        </Engine>
    </Service>
</Server>