Page 1 of 1

SOLVED - Configuring Apache HTTP Reverse-Proxy

PostPosted:Fri Dec 08, 2017 9:51 am
by maniachhz
Hi guys,

I read the manual: https://docs.openkm.com/kcenter/view/ok ... proxy.html

then done:
step-1. changed the port to 8181
Code: Select all
huanghanzhen@function:~$ cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

#Listen 80
Listen 8181

<IfModule ssl_module>
	Listen 443
</IfModule>

<IfModule mod_gnutls.c>
	Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
huanghanzhen@function:~$ 
step-2. added the redmine_openkm.conf, and enable the site
Code: Select all
huanghanzhen@function:~$ cat /etc/apache2/sites-available/redmine_openkm.conf
<VirtualHost *:8181>
    #SSLEngine On
    #SSLCertificateFile /etc/ssl/certs/redmine_openkm.crt
    #SSLCertificateKeyFile /etc/ssl/private/redmine_openkm.key

    ServerAdmin hanzhenhuang@function-g.com
    Servername localhost
    DocumentRoot /var/www/html/
    redirectMatch ^/openkm.* /OpenKM
    redirectMatch ^/$ /redmine/

     <Location /redmine>
         RailsEnv production
         RackBaseURI /redmine
         Options -MultiViews
    </Location>

    <Location /OpenKM>
        #ProxyRequests Off
        #ProxyPreserveHost On
        ProxyPass ajp://127.0.0.1:8009/OpenKM keepalive=On
        ProxyPassReverse http://localhost:8181/OpenKM
        
    </Location>

     ErrorLog /var/log/apache2/openkm-error.log
     CustomLog /var/log/apache2/openkm-access.log combined


</VirtualHost>
step-3. changed the OpenKM default port to:8181
Code: Select all
    <Connector port="8181" address="0.0.0.0" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
step-4.
Code: Select all
$ sudo /etc/init.d/apache2 start
$ sudo /opt/openkm/tomcat/bin/catalina.sh start 
Finishing above steps, the OpenKM works when i visit: http://xxxx:8181/OpenKM

My questions:
1. do i need add the port to
Code: Select all
 ProxyPassReverse http://localhost:8181/OpenKM 
on step-2 ?

2. do i need change the openkm to 8181? if i don't update 8080 to 8181, the OpenKM does not work.

In a word, is there a mistake in my operation above?

Thanks.

Re: Configuring Apache HTTP Reverse-Proxy

PostPosted:Fri Dec 08, 2017 10:40 am
by maniachhz
Never mind.

comment <Connector ... item on the step-3, the OpenKM works.
step-3. changed the OpenKM default port to:8181
<Connector port="8181" address="0.0.0.0" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />

Re: SOLVED - Configuring Apache HTTP Reverse-Proxy

PostPosted:Fri Dec 08, 2017 7:37 pm
by jllort
If you comment the 8080 ( or in your case 8180 ) server.xml line, then everything goes across the ajp.