A
A
alestro2016-03-10 12:41:07
Apache HTTP Server
alestro, 2016-03-10 12:41:07

How to attach ssl certificate in OpenServer?

I generated a self-signed ssl certificate like this:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout cert.key -out cert.crt

Then I skipped all the items except the Common name, specifying the domain name for which I certified the certificate.
Then I copied Apache-2.4-PHP-5.7_vhost.conf to the root of the domain folder. Added there
SSLCertificateFile        "%sprogdir%/userdata/config/bou.crt"
SSLCertificateKeyFile     "%sprogdir%/userdata/config/bou.key"

The result is the following:
#-----------------------------------------------#
# Начало блока конфигурации HTTP хоста
#-----------------------------------------------#
<VirtualHost *:%httpport%>
    DocumentRoot    "%hostdir%"
    ServerName      "%host%"
    ServerAlias     "%host%" %aliases%
    ScriptAlias     /cgi-bin/ "%hostdir%/cgi-bin/"
</VirtualHost>
#-----------------------------------------------#
# Конец блока конфигурации HTTP хоста
#-----------------------------------------------#

#-----------------------------------------------#
# Начало блока конфигурации HTTPS хоста
#-----------------------------------------------#
<VirtualHost *:%httpsport%>
    DocumentRoot    "%hostdir%"
    ServerName      "%host%"
    ServerAlias     "%host%" %aliases%
    ScriptAlias     /cgi-bin/ "%hostdir%/cgi-bin/"

    SSLEngine    on

    SetEnvIf User-Agent ".*MSIE [1-5].*" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0

    SetEnvIf User-Agent ".*MSIE [6-9].*" \
    ssl-unclean-shutdown
    SSLCertificateFile        "%sprogdir%/userdata/config/bou.crt"
    SSLCertificateKeyFile     "%sprogdir%/userdata/config/bou.key"
</VirtualHost>
#-----------------------------------------------#
# Конец блока конфигурации HTTPS хоста
#-----------------------------------------------#

Restarted the server and the result was 0.
Open Server version 5.2.3 + installed the module to work with php 7.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2017-01-04
@mavsan

Well, you generated the keys with the name cert.* and in the config you write bou.* and put the keys in %sprogdir%/userdata/config/ i.e. to the path that you specify in the config. %sprogdir% is the path to the openserver root, e.g. c:\openserver, i.e. full path in this case: c:\openserver\userdata\config\here_keys_generated
Yes, and access to sites by port (see openserver settings, 444 is standard there), i.e. path to the site:
https://your-site:444
Yes, and there are already certificates in the delivery, they are called server.crt and server.key (I have anyway), so it all comes down to go to https://your-site:444

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question