# Adding second SSL for second domain

**URL:** <https://help.nextcloud.com/t/adding-second-ssl-for-second-domain/165480>\
**Category:** ℹ️ Support\
**Created:** [July 4, 2023, 4:52am UTC](https://help.nextcloud.com/t/adding-second-ssl-for-second-domain/165480 "2023-07-04T04:52:48Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_449c533f586939b6e5f246632a46421f.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [July 5, 2023, 7:43am UTC](https://help.nextcloud.com/t/adding-second-ssl-for-second-domain/165480/11 "2023-07-05T07:43:07Z")

</div>

Hmm, not sure then. Maybe it is because both VirtualHosts are in the same config file… Usually Certbot automatically creates a second config file for the SSL config and adds redirect directives to the first one…

Example:

If your config file is named `nextcloud.conf`, Certbot will create a second config called `nextcloud-le-ssl.conf`

This would mean, that you now have two SSL configs for the same Server and Alias Names, but only the one in your first config file contains the additional directives for Nextcloud.

Maybe it would be easier to disable all of the existing configs, and start over with a fresh config.

```
ls /etc/apache2/sites-available

```

then disable all the configs:

```
a2dissite filename.conf

```

Then create a new simple config file as follows:

```auto
nano /etc/apache2/sites-available/nextcloud.conf

```

```auto
<VirtualHost *:80>
ServerName cloud.domain.com
ServerAlias cloud.domain2.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

```

Save the file and exit nano.

Enable the site:

```auto
a2ensite nextcloud.conf

```

Restart Apache and run certbot. Certbot will then create a file called `nextcloud-le-ssl.conf`, which already contains the directives from the first VirtualHost plus the SSL config. Leave those entries alone and only add the rest of your existing config under` <VirtualHost *443>` from the old config file to it:

---

_[View the full topic](https://help.nextcloud.com/t/adding-second-ssl-for-second-domain/165480)._
