# Multiple domain / 1 ip 1 webroot

**URL:** <https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390>\
**Category:** Help\
**Created:** [January 25, 2017, 9:34am UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390 "2017-01-25T09:34:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jd440](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jd440/32/10894_2.png) [@jd440](https://community.letsencrypt.org/u/jd440)\
**Post date:** [January 25, 2017, 9:34am UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/1 "2017-01-25T09:34:51Z")

</div>

I’m running different website (prestashop multi-domain) on my VDS which are all in the same folder/webroot and all using the same IP.

I already done

`certbot-auto certonly -w /home/sitexxx/web/www -d example.com -d www.example.com`

aNd planning

```
certbot-auto certonly -w /home/sitexxx/web/www -d example1.com -d www.example1.com
certbot-auto certonly -w /home/sitexxx/web/www -d example2.com -d www.example2.com
certbot-auto certonly -w /home/sitexxx/web/www -d example3.com -d www.example3.com

```

But I don’t know how could define one certif by domain?  
If i add a vhost conf with  
 or \<VirtualHost \*:443\>  
The same cert will be apply to all?

---

<div class="post-metadata">

**Author:** ![jd440](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jd440/32/10894_2.png) [@jd440](https://community.letsencrypt.org/u/jd440)\
**Post date:** [January 25, 2017, 10:10am UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/2 "2017-01-25T10:10:37Z")

</div>

I guess I should use sni

```
<VirtualHost *:443>
   ServerName www.example.com
   DocumentRoot /home/sitexxx/web/www

    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateChainFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>

<VirtualHost *:443>
   ServerName www.example1.com
   DocumentRoot /home/sitexxx/web/www

    SSLCertificateFile /etc/letsencrypt/live/example1.com/fullchain.pem
    SSLCertificateChainFile /etc/letsencrypt/live/example1.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example1.com/privkey.pem
</VirtualHost>

```

is it correct?

---

<div class="post-metadata">

**Author:** ![serverco](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/serverco/32/4251_2.png) [@serverco](https://community.letsencrypt.org/u/serverco)\
**Post date:** [January 25, 2017, 8:34pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/3 "2017-01-25T20:34:11Z")

</div>

roughly, yes

(without your domain name and details I can’t be certain )

---

<div class="post-metadata">

**Author:** ![jd440](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jd440/32/10894_2.png) [@jd440](https://community.letsencrypt.org/u/jd440)\
**Post date:** [January 26, 2017, 12:49pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/4 "2017-01-26T12:49:59Z")

</div>

If to start I wish to listen 443 only for one site  
is there a way?

because As soon as i will add `listen: 443` the server will listen and reply to https request.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [January 26, 2017, 1:06pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/5 "2017-01-26T13:06:28Z")

</div>

> [@jd440](#):
>
> If to start I wish to listen 443 only for one siteis there a way?
> 
> because As soon as i will add listen: 443 the server will listen and reply to https request.

Apache will always reply with the first certificate in the first `<VirtualHost>` section if it gets a request for a hostname it doesn't recognise elsewhere. This is troublesome if the hostname entered by the user is different from this default hostname.

But I'm not sure I see the problem: most users will just type in the hostname, without the `https://` in front of it. 99,99&nbsp;% of the time, it's the webservers maintainers responsibility to redirect HTTP to HTTP **S**. If you're just redirecting for _one_ domain, then other domains shouldn't be affected.

Also, the following is redundant:

> [@jd440](#):
>
> ```
> SSLCertificateFile /etc/letsencrypt/live/example1.com/fullchain.pem
> SSLCertificateChainFile /etc/letsencrypt/live/example1.com/fullchain.pem
> 
> ```

If you have Apache 2.4.8 or above, then `SSLCertificateChainFile` is _deprecated_ and having `SSLCertificateFile` point to `fullchain.pem` is perfect. If you have a Apache version lower than 2.4.8, then you should point `SSLCertificateFile` to `cert.pem` and `SSLCertificateChainFile` to `chain.pem`. I'm not sure if Apache \<2.4.8 will understand `fullchain.pem` if entered in the two directives.

---

<div class="post-metadata">

**Author:** ![jd440](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jd440/32/10894_2.png) [@jd440](https://community.letsencrypt.org/u/jd440)\
**Post date:** [January 26, 2017, 1:13pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/6 "2017-01-26T13:13:39Z")

</div>

Ok so  
I will just at first redirect https --\> http until all test succeded and then rediirect http --\> https

if user type hostname without http or https does who choose?  
navigator/ server?  
what the order?

So as I am on apache 2.2  
i should type:

```
SSLCertificateFile /etc/letsencrypt/live/example1.com/chain.pem
SSLCertificateChainFile /etc/letsencrypt/live/example1.com/chain.pem
```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [January 26, 2017, 1:22pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/7 "2017-01-26T13:22:40Z")

</div>

> [@jd440](#):
>
> if user type hostname without http or https does who choose?navigator/ server?what the order?

The clients browser. Normally, it will choose HTTP, unless you've set a HSTS header or HSTS preload. Any redirect to HTTP **s** will be done by your server otherwise, if you've set that up of course.

> [@jd440](#):
>
> So as I am on apache 2.2i should type:
> 
> SSLCertificateFile /etc/letsencrypt/live/example1.com/chain.pem  
> SSLCertificateChainFile /etc/letsencrypt/live/example1.com/chain.pem

No. That's incorrect. Please read carefully....

---

<div class="post-metadata">

**Author:** ![jd440](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jd440/32/10894_2.png) [@jd440](https://community.letsencrypt.org/u/jd440)\
**Post date:** [January 26, 2017, 1:27pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/8 "2017-01-26T13:27:34Z")

</div>

> [@Osiris](#):
>
> If you have a Apache version lower than 2.4.8, then you should point SSLCertificateFile to cert.pem and SSLCertificateChainFile to chain.pem.

Sorry so

```
SSLCertificateFile /etc/letsencrypt/live/example1.com/cert.pem
SSLCertificateChainFile /etc/letsencrypt/live/example1.com/chain.pem

```

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [January 26, 2017, 1:29pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/9 "2017-01-26T13:29:15Z")

</div>

Correct.&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [February 25, 2017, 1:38pm UTC](https://community.letsencrypt.org/t/multiple-domain-1-ip-1-webroot/26390/10 "2017-02-25T13:38:43Z")

</div>

Closed on February 25, 2017, 1:38pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
