Hello I am trying to setup apache2 as reverse proxy on Ubuntu. For the backed I have tomcat 7. For the configuration file /etc/apache2/sites-enabled/example.co.conf

<VirtualHost *:80>
        ServerName example.co
        ServerAlias *example.co
        ServerSignature Off

        RewriteEngine On
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

        ErrorLog /var/log/apache2/redirect.error.log
        LogLevel debug

<VirtualHost *:443>
        ServerName example.co
        ServerAlias *example.co
        ProxyPreserveHost On
        ProxyRequests off
        AllowEncodedSlashes NoDecode

    <Proxy *>
          Order deny,allow
          Allow from all


        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/example.co/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/example.co/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf

        ProxyPass / http://localhost:8080/ nocanon
        ProxyPassReverse / http://localhost:8080/

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"

        LogLevel debug
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

I tried to check using:

$elinks https://localhost 

and it's works but when I tried from outside not working.

Any Help!

  • Could you please try to add a bit more information maybe extract of the access log showing that it's not working from outside your computer also the network configuration or the list of TCP open port on your server lsof -i TCP all that is important. – Kiwy Mar 19 '18 at 8:58

I noticed that I didn't open 443 port on Amazon AWS. After I opened the port it's work. this configuration works with me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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