0

I have generated my app using Jhipster. Configured it to run on amazon ec2 with Ubuntu 16.x and apache with following configuration and godaddy a record. When I hit the website url it maps and renders the site without any issues.

apache2 configuration

<VirtualHost *:80>
    ServerName 111.22.33.444
    ProxyPreserveHost On
    ProxyRequests Off

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://111.22.33.444:8080/
    ProxyPassReverse / http://111.22.33.444:8080/

</VirtualHost>

Nest step, trying to configure SSL. I have bought the SSL from godaddy for my domain, configured it and uploaded the *.crt files into /etc/apache2/ssl. I quickly realized just by adding another virtual host configuration for port 443 will not work because JHipster app is running on 8080. I went back and looked at https://www.jhipster.tech/production/ and they have instructions for configuring SSL with HTTPS configuration with a front-end proxy and this where I got lost and am unable to configure SSL and serve up my domain on https.

What is not clear is can I still run the app on 8080 and simply follow the instructions under HTTPS configuration with a front-end proxy? First, I configured apache using "lets encrypt" using the following command

sudo certbot --apache -d doamin.com --agree-tos -m [email protected] --redirect

it failed saying

Failed redirect for domain.com

Unable to set enhancement redirect for domain.com

It didn't work.

What are the changes for Jhipster application that I need to do? Should it run on 443 or continue to run 8080 and update virtual host configuration? How should i configure virtual host?

I have searched high and low with no instructions. Any direction is much appreciated.

2
  • Have you tried lets-encrypt without the --redirect parameter? I'm guessing it fails because you don't have any hosts declared in your existing virtual host (or maybe you removed them?). Your setup looks correct (http request -> apache -> jhipster app) Jul 2, 2018 at 15:36
  • @JonRuddell Thank you for the response. You are right that I don't have any hosts declared in my virtual host. I tried different combinations including lets encrypt with no luck. Even though lets-encrypt gives error message it does update the virtual-host entry for 443. My question is can i run the app on 8080 and still configure HTTPS? If so, what should be the apache configuration? Jul 2, 2018 at 23:25

1 Answer 1

0

Assuming your app is available at http://127.0.0.1:8080/, you can successfully configure Apache for HTTPS with Certbot by following the below steps.

Setup server with:

sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-apache apache2

Start with the config:

<VirtualHost *:80>
        ServerName example.com
        ServerAlias example.com

        ProxyPass / http://127.0.0.1:8080/
        ProxyPassReverse / http://127.0.0.1:8080/

        ProxyPreserveHost On
        ProxyRequests Off

</VirtualHost>

Enable plugins and restart Apache2, making the app accessible at the domain configured above:

a2enmod headers proxy proxy_http
service apache2 restart

Then run certbot with the instructions in the docs:

sudo certbot --apache -d example.com

After that, your app will be accessible at the domain you configured and served via HTTPS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.