D
D
Drum Kit2015-06-27 01:43:40
Programming
Drum Kit, 2015-06-27 01:43:40

How to create https?

I have generated an ssl certificate and I am trying to connect the certificate to apache but it does not work, I tried to connect via http-ssl.conf

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2015-06-27
@arayik

In the sites-available folder, create a file with a virtual host config (or add the following directives to an existing config):

<IfModule mod_ssl.c>

<VirtualHost example.com: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 example.com

        ServerAdmin [email protected]
        DocumentRoot /var/www/example.com

        # 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}/example.com-error.log
        CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined


       #   SSL Engine Switch:
       #   Enable/Disable SSL for this virtual host.

       SSLEngine on
       SSLProtocol all -SSLv2
       ServerSignature On
       SSLCertificateFile    /etc/apache2/ssl/example.com.crt
       SSLCertificateKeyFile /etc/apache2/ssl/example.com.private.key
       SSLCertificateChainFile /etc/apache2/ssl/root_bundle.crt

</VirtualHost>
</IfModule>

example.com.crt your certificate
example.com.private.key - your private key
root_bundle.crt an additional file where certificates of certification authorities are collected
(this config may have nothing to do with your situation, since you did not explain anything at all in the question ... in general, we could shorten the question to "https does not work, why?")
Then execute the sudo a2ensite example.com command (where example.com is the file name with the virtual host config) or manually create a symlink to the virtual host config in the sites- folder enabled and restart Apache.
All you can do is launch your browser and go to https://example.com

M
Marat, 2015-06-27
@7kmarat

your website locally or hosted

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question