Clone wiki

server / Apache HTTP - HTTPS with SSL

HTTP Server powered by Apache can be configured to run HTTP (with SSL). This is an example of simple configuration for 8443 port (or any other valid port):

  1. Make sure HTTP Server powered by Apache app is installed
  2. Launch HTTP Server powered by Apache app and check if server is not running (stop if it is running)
  3. Generate SSL certificate and key files. It can be easily done on PC with OpenSSL command:

    # this command will generate certificate and it`s key files to certificate.cert and certificate.key
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certificate.key -out certificate.cert
    
  4. Once you have certificate and key files, put them to your Android device, to config directory (by default it is /sdcard/htdocs/config). So if you have default config directory path you should put to those files:

    # SSL certificate file
    /sdcard/htdocs/config/certificate.cert
    
    # SSL certificate key file
    /sdcard/htdocs/config/certificate.key
    
  5. Now add this configuration to httpd.conf (by default it is on /sdcard/htdocs/config/httpd.conf):

    # Enable listening on 8443 port (change to any valid port if needed)
    Listen 8443
    
    # Enable virtual host on 8443 port and any IP
    <VirtualHost *:8443>
        # Enable SSL on this virtual host and port
        SSLEngine on
    
        # Set SSL certificate file path
        SSLCertificateFile "/sdcard/htdocs/config/certificate.cert"
    
        # Set SSL certificate key file path
        SSLCertificateKeyFile "/sdcard/htdocs/config/certificate.key"
    </VirtualHost>
    
  6. That`s all - now you can start server and check if everything is working fine using browser. For example if you are running server on 127.0.0.1 IP, then you can access it using: https://127.0.0.1:8443

Updated