Setup Multiple SSL certificate
I have two website configured on my server, let's say exmaple.com and example1.com and i have configured SSL certificate for both when i visit example.com it is working fine with ssl but when i visit example1.com it is not working fine it laods certificate of example.com when i visit the site information from browser,
My apache httpd config file look like below
<virtualhost *:443=""></virtualhost>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html
SSLEngine On
SSLCertificateFile /etc/ssl/example/www.example.com.crt
SSLCertificateKeyFile /etc/ssl/example/www.example.com.key
SSLCACertificateFile /etc/ssl/example/www.example.com.crtc
<Directory "/var/www/html">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# SSLProxyVerify none
# SSLProxyEngine On
ServerName localhost
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /adminer.php !
ProxyPass /sitemap.xml !
ProxyPass /php_info.php !
ProxyPass /.htaccess !
ProxyPass /robots.txt !
ProxyPass /web-api !
ProxyPass / http://0.0.0.0:4000/
ProxyPassReverse / http://0.0.0.0:4000/
<virtualhost *:443=""></virtualhost>
ServerName example1.com
ServerAlias www.example1.com
DocumentRoot /var/www/example1
SSLEngine On
SSLCertificateFile /etc/ssl/example1/www.example1.com.crt
SSLCertificateKeyFile /etc/ssl/example1/www.example1.com.key
SSLCACertificateFile /etc/ssl/example1/www.example1.com.crtc
<Directory "/var/www/example1">
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ServerName localhost
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /adminer.php !
ProxyPass /sitemap.xml !
ProxyPass /php_info.php !
ProxyPass /.htaccess !
ProxyPass /robots.txt !
ProxyPass /web-api !
ProxyPass / http://0.0.0.0:4001/
ProxyPassReverse / http://0.0.0.0:4001/
2 Replies
The behavior you're describing sounds like both domains are trying to use the same SSL cert, which may be the issue. Even if they're served from the same Linode, each domain will need its own independent certs.
After looking over this article:
Using Multiple SSL Certificates in Apache with One IP Address
It looks to me that you need to create a separate <virtualhost> section for each domain. In your example, it doesn't appear to be the case. </virtualhost>
It may also be helpful to use an online SSL checker. I use the one from SSLShopper often. You put in the domain, and it'll return a report based on what it sees.
@watrick:
You write:
It looks to me that you need to create a separate <virtualhost> section for each domain. In your example, it doesn't appear to be the case.
I think he does…it's just that the Markdown formatting of @tommattea's post is messed up ;-) I see
<virtualhost *:443=""> </virtualhost>
between each block of server configuration. If the =""
are really in @tommattea's configuration, then that's wrong…and could be the source of the problem. I'd also have a look at the .htaccess
file in each DocumentRoot and make sure any of the SSL configuration is not being overridden (@tommattea has probably already thought of that, though).
Also, according to this:
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxy
the format of the <Proxy> configuration is incorrect…the wildcard should be enclosed in double-quotes:
<Proxy "*">…</Proxy>
The
ServerName localhost
directives in each virtual host could also be the source of the problem. These are overriding the ServerName directives earlier on. Apache named virtual hosts (which is what @tommattea's trying to do here) depend on the ServerName to dispatch requests correctly.
@tommattea, have you run /usr/sbin/apachectl -S
(you need to be root) to see what it says about your virtual host configuration? /usr/sbin/apachectl configtest
is also helpful in debugging Apache configuration issues.
-- sw