Skip to content

Instantly share code, notes, and snippets.

@Eng-Fouad
Last active June 15, 2018 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Eng-Fouad/66ce183885e63863a1732dea1b54901d to your computer and use it in GitHub Desktop.
Save Eng-Fouad/66ce183885e63863a1732dea1b54901d to your computer and use it in GitHub Desktop.
Hosting Websphere Liberty behind a proxy server (apache) under a subdomain

/opt/wlp/usr/servers/defaultServer/server.xml:

...

<keyStore id="defaultKeyStore"
       type="JKS" password="{xor}Lz4sLB80OiZmZmY=" 
       pollingRate="5s" 
       updateTrigger="polled" />

...

<httpEndpoint id="defaultHttpEndpoint"
              host="*"
              httpPort="-1"
              httpsPort="9443" />

/etc/apache2/sites-enabled/000-default-le-ssl.conf:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    SSLProxyEngine on
    ProxyPreserveHost On
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    <Proxy *>
        Order allow,deny
        Allow from all
    </Proxy>
    ProxyPass / https://localhost:9443/
    ProxyPassReverse / https://localhost:9443/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    SSLCertificateFile /etc/letsencrypt/live/fouad.io/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/fouad.io/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    ServerName api.fouad.io
</VirtualHost>
...
</IfModule>

/etc/apache2/sites-enabled/000-default.conf:

<VirtualHost *:80>
    RewriteEngine on
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment