0

I would like to learn how to properly configure Apache2 and Tomcat (TomEE)/8.5.6 (7.0.2) for GWT HTTPS application on fresh installation of Ubuntu Server 16.04.3.

Here are the steps that I used.

  1. Configured my DNS records.

    enter image description here

  2. Checked Apache configuration.

    $ sudo apache2ctl -S
    VirtualHost configuration: 
    *:80   zethanath.tk (/etc/apache2/sites-enabled/000-default.conf:1)
    *:443 is a NameVirtualHost default server zethanath.tk (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
    port 443 namevhost zethanath.tk (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
    alias www.zethanath.tk
    alias servlet.zethanath.tk
    port 443 namevhost zethanath.tk (/etc/apache2/sites-enabled/default-ssl.conf:2)
    port 443 namevhost www.zethanath.tk (/etc/apache2/sites-enabled/default-ssl.conf:140)
    
    ServerRoot: "/etc/apache2"
    Main DocumentRoot: "/var/www/html"
    Main ErrorLog: "/var/log/apache2/error.log"
    Mutex rewrite-map: using_defaults
    Mutex ssl-stapling-refresh: using_defaults
    Mutex ssl-stapling: using_defaults
    Mutex proxy: using_defaults
    Mutex ssl-cache: using_defaults
    Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
    Mutex watchdog-callback: using_defaults
    Mutex proxy-balancer-shm: using_defaults
    PidFile: "/var/run/apache2/apache2.pid"
    Define: DUMP_VHOSTS
    Define: DUMP_RUN_CFG
    User: name="www-data" id=33
    Group: name="www-data" id=33
    
  3. Configured my /etc/apache2/sites-enabled/default-ssl.conf

    <IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin erick9.hi5@gmail.com
                ServerName  zethanath.tk
    
                ProxyPreserveHost On
                ProxyPass / http://192.168.1.70:8080/index//
                ProxyPassReverse / http://192.168.1.70:8080/index//
    
                JKMount /* ajp13_worker
    
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
    
                SSL Engine Switch:
                #   Enable/Disable SSL for this virtual host.
                SSLEngine on
    
                #   A self-signed (snakeoil) certificate can be created by installing
                #   the ssl-cert package. See
                #   /usr/share/doc/apache2/README.Debian.gz for more info.
                #   If both key and certificate are stored in the same file, only the
                #   SSLCertificateFile directive is needed.
                SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
                Include /etc/letsencrypt/options-ssl-apache.conf
    
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
    
        </VirtualHost>
    
        <VirtualHost _default_:443>
                ServerAdmin erick9.hi5@gmail.com
                ServerName  www.zethanath.tk
    
                ProxyPreserveHost On
                ProxyPass / http://192.168.1.70:8080/index//
                ProxyPassReverse / http://192.168.1.70:8080/index//
    
                JKMount /* ajp13_worker
    
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
    
                SSLEngine on
    
                #   A self-signed (snakeoil) certificate can be created by installing
                #   the ssl-cert package. See
                #   /usr/share/doc/apache2/README.Debian.gz for more info.
                #   If both key and certificate are stored in the same file, only the
                #   SSLCertificateFile directive is needed.
                SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
                Include /etc/letsencrypt/options-ssl-apache.conf
    
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
    
        </VirtualHost>
    </IfModule>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    
  4. Configured my /etc/apache2/sites-enabled/000-default-le-ssl.conf

    <IfModule mod_ssl.c>
    <VirtualHost *:443>
    
        ServerName zethanath.tk
        ServerAlias www.zethanath.tk servlet.zethanath.tk
    
        ProxyPreserveHost On
        ProxyPass / http://192.168.1.70:8080/index//
        ProxyPassReverse / http://192.168.1.70:8080/index//
    
        JKMount /* ajp13_worker
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
    
    </VirtualHost>
    </IfModule>
    
  5. Configured my /etc/apache2/sites-enabled/000-default.conf

    <VirtualHost *:80 >
        ServerName  zethanath.tk
        ServerAlias www.zethanath.tk servlet.zethanath.tk
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        #JKMount /* ajp13_worker
    
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
    
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =zethanath.tk
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}   
    [END,NE,R=permanent]
    </VirtualHost>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    

Please note that I have installed libapache2-mod-jk. The content of my /etc/hosts are below.

127.0.0.1       localhost
127.0.1.1       erick-ASRock-N68C-GS4-FX
192.168.1.70    zethanath.tk

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

For the following addresses in Firefox, I get these results. Are they correct?

  1. http://zethanath.tk
    enter image description here

  2. http://www.zethanath.tk

    http://192.168.1.70:8080/index/
    
  3. http://servlet.zethanath.tk

    http://servlet.zethanath.tk
    Unable to Connect
    
  4. What I really want to do is to let Apache2 serve my certificate and it should redirect me to TomEE server. I would not let Apache2 serve any content at all, beside the certificate. The rest of the contents should be served through GWT (Google Web tool kit) applications only. I think GWT would expect the setting like below, but I do not know how to do it.

From the GWT docs:

Your Apache server is running on www.example.com
Your Tomcat server is running on servlet.example.com:8080
Your GWT module has a `<rename-to="myapp">`
You have one RPC servlet, mapped into /myapp/myService 

The idea is to have Apache proxy requests to the servlet to the other server such that:

(http)://www.example.com/MyApp/myapp/myService --> (http)://servlet.example.com:8080/MyApp/myapp/myService

The following Apache configuration sets up such a rule using a Proxy:

ProxyPass /MyApp/myapp/myService (http)://servlet.example.com:8080/MyApp/myapp/myService 
ProxyPassReverse /MyApp/myapp/myService (http)://servlet.example.com:8080/MyApp/myapp/myService 

To verify this is working, use a web browser to hit both (http)://www.example.com/MyApp/myapp/myService and (http)://servlet.example.com:8080/MyApp/myapp/myService.

You should get the same result in both cases (typically a 405: HTTP method GET is not supported by this URL, which is good). If you get something different hitting the second URL, you may have a configuration issue.

0

I am able to progress a little further. However, I still do not understand certain things. I pasted my questions at the end of this posting.

Here are the steps that I have just done.

  1. I reconfigured "000-default-le-ssl.conf".

$ sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf

    <IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName  zethanath.tk
        ServerAlias zethanath.tk

        ProxyPreserveHost On
        ProxyPass / (http)://192.168.1.70:8080/Index//
        ProxyPassReverse / (http)://192.168.1.70:8080/Index//

        #DocumentRoot /var/www/html

        JKMount /* ajp13_worker

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

        SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost> 
    <VirtualHost *:443>
        ServerName (www).zethanath.tk
        ServerAlias zethanath.tk

        ProxyPreserveHost On
        ProxyPass / (http)://192.168.1.70:8080/Index//
        ProxyPassReverse / (http)://192.168.1.70:8080/Index//

        #DocumentRoot /var/www/html

        JKMount /* ajp13_worker

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

        SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost>
    <VirtualHost *:443>
        ServerName  servlet.zethanath.tk
        ServerAlias zethanath.tk

        ProxyPreserveHost On
        ProxyPass / (http)://192.168.1.70:8080/Index//
        ProxyPassReverse / (http)://192.168.1.70:8080/Index//

        #DocumentRoot /var/www/html

        JKMount /* ajp13_worker

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

        SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost>
    </IfModule>
  1. I reconfigured "default-ssl.conf". $ sudo nano /etc/apache2/sites-enabled/default-ssl.conf

    <IfModule mod_ssl.c>
    <VirtualHost _default_:443>
            ServerAdmin erick9.hi5@gmail.com
            ServerName  zethanath.tk
            ServerAlias zethanath.tk
    
            ProxyPreserveHost On
            ProxyPass / (http)://192.168.1.70:8080/Index//
            ProxyPassReverse / (http)://192.168.1.70:8080/Index//
    
            #DocumentRoot /var/www/html
            JKMount /* ajp13_worker
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
            SSLEngine on
    
            SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
            Include /etc/letsencrypt/options-ssl-apache.conf
    
            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                            SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
            </Directory>
    </VirtualHost>
    
    <VirtualHost _default_:443>
            ServerAdmin erick9.hi5@gmail.com
            ServerName  (www).zethanath.tk
            ServerAlias zethanath.tk
    
            ProxyPreserveHost On
            ProxyPass / (http)://192.168.1.70:8080/Index//
            ProxyPassReverse / (http)://192.168.1.70:8080/Index//
    
            #DocumentRoot /var/www/html
            JKMount /* ajp13_worker
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
            SSLEngine on
    
            SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
            Include /etc/letsencrypt/options-ssl-apache.conf
    
            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                            SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
            </Directory>
    </VirtualHost>
    <VirtualHost _default_:443>
            ServerAdmin erick9.hi5@gmail.com
            ServerName  servlet.zethanath.tk
            ServerAlias zethanath.tk
    
            ProxyPreserveHost On
            ProxyPass / (http)://192.168.1.70:8080/Index//
            ProxyPassReverse / (http)://192.168.1.70:8080/Index//
    
            #DocumentRoot /var/www/html
            JKMount /* ajp13_worker
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
            SSLEngine on
    
            SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
            Include /etc/letsencrypt/options-ssl-apache.conf
    
            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                            SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
            </Directory>
        </VirtualHost>
    </IfModule>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    
  2. I reconfigured "000-default.conf".

$ sudo nano /etc/apache2/sites-enabled/000-default.conf

    <VirtualHost *:80 >
        ServerName  zethanath.tk
        ServerAlias zethanath.tk

        ProxyPreserveHost On
        ProxyPass / (http)://192.168.1.70:8080/Index//
        ProxyPassReverse / (http)://192.168.1.70:8080/Index//

        #ServerAdmin erick9.hi5@gmail.com
        #DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        #JKMount /* ajp13_worker

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =zethanath.tk
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    </VirtualHost>

    <VirtualHost *:80 >
        ServerName  (www).zethanath.tk
        ServerAlias zethanath.tk

        ProxyPreserveHost On
        ProxyPass / (http)://192.168.1.70:8080/Index//
        ProxyPassReverse / (http)://192.168.1.70:8080/Index//

        #ServerAdmin erick9.hi5@gmail.com
        #DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        #JKMount /* ajp13_worker

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =(www).zethanath.tk
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    </VirtualHost>

    <VirtualHost *:80 >
        ServerName  servlet.zethanath.tk
        ServerAlias zethanath.tk

        ProxyPreserveHost On
        ProxyPass / (http)://192.168.1.70:8080/Index//
        ProxyPassReverse / (http)://192.168.1.70:8080/Index//

        #ServerAdmin erick9.hi5@gmail.com
        #DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        #JKMount /* ajp13_worker

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =zethanath.tk
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    </VirtualHost>

    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  1. I checked these configuration syntax.

$ sudo apache2ctl configtest Syntax OK

  1. I restarted my server.

$ sudo systemctl restart apache2

  1. Now, when I typed (http)://zethanath.tk, I would receive the following.

enter image description here

  1. Now, when I typed (http)://(www).zethanath.tk, I would receive (https) site, which is what I want.

enter image description here

  1. Now, when I typed (http)://servlet.zethanath.tk, I would also receive (https) site, which is what I want as well.

My questions to you are.

  1. What do I have to do to get the https, when I typed (http)://zethanath.tk in the browser?

  2. What is the proper way to serve (http/https)://servlet.zethanath.tk behind my router only? I do not want it to show outside my router.

Thank you.

0

The following steps solved my problem.

  1. sudo nano /etc/apache2/sites-enabled/000-default.conf

    <VirtualHost *:80 >
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    
    ServerName  www.zethanath.tk
    ServerAlias servlet.zethanath.tk zethanath.tk
    
    Redirect permanent "/" "https://www.zethanath.tk/"
    
    ProxyPreserveHost On
    ProxyPass / http://192.168.1.70:8080/Index/
    ProxyPassReverse / http://192.168.1.70:8080/Index/
    
    #ServerAdmin erick9.hi5@gmail.com
    #DocumentRoot /var/www/html
    
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    #JKMount /* ajp13_worker
    
    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    #JKMount /* ajp13_worker
    
    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
    
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.zethanath.tk
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
    
    </VirtualHost>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    
  2. sudo nano /etc/apache2/sites-enabled/000-default-le-ssl.conf

    <IfModule mod_ssl.c>
    <VirtualHost *:443>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    
    ServerName  www.zethanath.tk
    ServerAlias servlet.zethanath.tk zethanath.tk
    
    Redirect permanent "/" "https://www.zethanath.tk/"
    
    ProxyPreserveHost On
    ProxyPass / http://192.168.1.70:8080/Index/
    ProxyPassReverse / http://192.168.1.70:8080/Index/
    
    #DocumentRoot /var/www/html
    
    #JKMount /* ajp13_worker
    
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
    
    SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    
    </VirtualHost>
    
    </IfModule>
    
  3. sudo nano /etc/apache2/sites-available/default-ssl.conf

    <IfModule mod_ssl.c>
            <VirtualHost _default_:443>
            ServerAdmin erick9.hi5@gmail.com
            ServerName  www.zethanath.tk
            ServerAlias servlet.zethanath.tk zethanath.tk
    
            Redirect permanent "/" "https://www.zethanath.tk/"
    
            ProxyPreserveHost On
            ProxyPass / http://192.168.1.70:8080/Index/
            ProxyPassReverse / http://192.168.1.70:8080/Index/
    
            #DocumentRoot /var/www/html
            #JKMount /* ajp13_worker
    
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
            # For most configuration files from conf-available/, which are
            # enabled or disabled at a global level, it is possible to
            # include a line for only one particular virtual host. For example the
            # following line enables the CGI configuration for this host only
            # after it has been globally disabled with "a2disconf".
            #Include conf-available/serve-cgi-bin.conf
    
            #   SSL Engine Switch:
            #   Enable/Disable SSL for this virtual host.
            SSLEngine on
    
            #   A self-signed (snakeoil) certificate can be created by installing
            #   the ssl-cert package. See
            #   /usr/share/doc/apache2/README.Debian.gz for more info.
            #   If both key and certificate are stored in the same file, only the
            #   SSLCertificateFile directive is needed.
            SSLCertificateFile /etc/letsencrypt/live/zethanath.tk/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/zethanath.tk/privkey.pem
            Include /etc/letsencrypt/options-ssl-apache.conf
    
            #   Server Certificate Chain:
            #   Point SSLCertificateChainFile at a file containing the
            #   concatenation of PEM encoded CA certificates which form the
            #   certificate chain for the server certificate. Alternatively
            #   the referenced file can be the same as SSLCertificateFile
            #   when the CA certificates are directly appended to the server
            #   certificate for convinience.
            #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt
    
            #   Certificate Authority (CA):
            #   Set the CA certificate verification path where to find CA
            #   certificates for client authentication or alternatively one
            #   huge file containing all of them (file must be PEM encoded)
            #   Note: Inside SSLCACertificatePath you need hash symlinks
            #                to point to the certificate files. Use the provided
            #                Makefile to update the hash symlinks after changes.
            #SSLCACertificatePath /etc/ssl/certs/
            #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt
    
            #   Certificate Revocation Lists (CRL):
            #   Set the CA revocation path where to find CA CRLs for client
            #   authentication or alternatively one huge file containing all
            #   of them (file must be PEM encoded)
            #   Note: Inside SSLCARevocationPath you need hash symlinks
            #                to point to the certificate files. Use the provided
            #                Makefile to update the hash symlinks after changes.
            #SSLCARevocationPath /etc/apache2/ssl.crl/
            #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl
    
            #   Client Authentication (Type):
            #   Client certificate verification type and depth.  Types are
            #   none, optional, require and optional_no_ca.  Depth is a
            #   number which specifies how deeply to verify the certificate
            #   issuer chain before deciding the certificate is not valid.
            #SSLVerifyClient require
            #SSLVerifyDepth  10
    
            #   SSL Engine Options:
            #   Set various options for the SSL engine.
            #   o FakeBasicAuth:
            #        Translate the client X.509 into a Basic Authorisation.  This means that
            #        the standard Auth/DBMAuth methods can be used for access control.  The
            #        user name is the `one line' version of the client's X.509 certificate.
            #        Note that no password is obtained from the user. Every entry in the user
            #        file needs this password: `xxj31ZMTZzkVA'.
            #   o ExportCertData:
            #        This exports two additional environment variables: SSL_CLIENT_CERT and
            #        SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
            #        server (always existing) and the client (only existing when client
            #        authentication is used). This can be used to import the certificates
            #        into CGI scripts.
            #   o StdEnvVars:
            #        This exports the standard SSL/TLS related `SSL_*' environment variables.
            #        Per default this exportation is switched off for performance reasons,
            #        because the extraction step is an expensive operation and is usually
            #        useless for serving static content. So one usually enables the
            #        exportation for CGI and SSI requests only.
            #   o OptRenegotiate:
            #        This enables optimized SSL connection renegotiation handling when SSL
            #        directives are used in per-directory context.
            #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
            <FilesMatch "\.(cgi|shtml|phtml|php)$">
                            SSLOptions +StdEnvVars
            </FilesMatch>
            <Directory /usr/lib/cgi-bin>
                            SSLOptions +StdEnvVars
            </Directory>
    
            #   SSL Protocol Adjustments:
            #   The safe and default but still SSL/TLS standard compliant shutdown
            #   approach is that mod_ssl sends the close notify alert but doesn't wait for
            #   the close notify alert from client. When you need a different shutdown
            #   approach you can use one of the following variables:
            #   o ssl-unclean-shutdown:
            #        This forces an unclean shutdown when the connection is closed, i.e. no
            #        SSL close notify alert is send or allowed to received.  This violates
            #        the SSL/TLS standard but is needed for some brain-dead browsers. Use
            #        this when you receive I/O errors because of the standard approach where
            #        mod_ssl sends the close notify alert.
            #   o ssl-accurate-shutdown:
            #        This forces an accurate shutdown when the connection is closed, i.e. a
            #        SSL close notify alert is send and mod_ssl waits for the close notify
            #        alert of the client. This is 100% SSL/TLS standard compliant, but in
            #        practice often causes hanging connections with brain-dead browsers. Use
            #        this only for browsers where you know that their SSL implementation
            #        works correctly.
            #   Notice: Most problems of broken clients are also related to the HTTP
            #   keep-alive facility, so you usually additionally want to disable
            #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
            #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
            #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
            #   "force-response-1.0" for this.
            # BrowserMatch "MSIE [2-6]" \
            #               nokeepalive ssl-unclean-shutdown \
            #               downgrade-1.0 force-response-1.0
    
    </VirtualHost>
    
    </IfModule>
    
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
    
  4. $ sudo apache2ctl configtest Syntax OK

  5. $ sudo systemctl restart apache2

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.