S
S
sm1tt2017-02-06 12:04:39
Apache HTTP Server
sm1tt, 2017-02-06 12:04:39

How to host two different https sites, with different certificates on the same apache2 IP?

Good afternoon, is this possible? I would like to place the second one, but with my own certificate, and to also redirect it from http to https.
Now one site is hosted with the following config:

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName site.ru
 	CustomLog /var/log/apache2/site.ru.access.log combined
  ErrorLog /var/log/apache2/site.ru.error.log
  ServerAdmin [email protected]
  AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
  AddType application/x-httpd-php-source .phps
        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCertificateFile "/etc/ssl/certs/cert.crt"
        SSLCertificateKeyFile "/etc/ssl/private/key.key"
  SSLCertificateChainFile "/etc/ssl/certs/chain.crt" 
        DocumentRoot /var/www/site.ru/public
        <Directory /var/www/site.ru>
            AllowOverride All
  Options -ExecCGI -Includes
        </Directory>
    </VirtualHost>
</IfModule>

<VirtualHost *:80>
  ServerName site.ru
  ServerAlias www.site.ru

  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://site.ru%{REQUEST_URI}
</VirtualHost>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2017-02-06
@sm1tt

https://www.digicert.com/ssl-support/apache-multip...
https://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question