Installing Nextcloud and Wordpress in the same directory

Hello I’m running a wordpress site on my own server with let’s encrypt enabled.
I would like to have nextcloud showing like this:
Worpress is installed in the /var/www/html/wordpress directory. Everything works fine. I then installed Nextcloud in the same location /var/www/html/nextcloud.
Once I enabled my nextcloud.conf i get an SSL error.

this is my wordpress-le-ssl.conf file

<IfModule mod_ssl.c>

<VirtualHost *:443>
DocumentRoot /var/www/html/terraveler
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/

this is my nextcloud.conf file

<IfModule mod_ssl.c>
 DocumentRoot /var/www/html

 <Directory /var/www/html/>
   Options +FollowSymlinks
   AllowOverride All

  <IfModule mod_dav.c>
    Dav off

   SetEnv HOME /var/www/html/
   SetEnv HTTP_HOME /var/www/html/

 <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15768000; preload"

 SSLEngine on
 SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
 SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

Where do I go wrong?

Thank you

Wouldn’t it be good to let us know what exact SSL error is being displayed?!

Administrators are encouraged to install Nextcloud on a dedicated domain such as cloud.domain.tld instead of domain.tld to gain all the benefits offered by the Same-Origin-Policy.

Along with what Sanook said, I believe it is best to use subdomains.

I have done what you describe using a subdomain for the nextcloud portion without issues with my SSL cert, if I understand your problem correctly.

e.g. I have wordpress installed for the root folder of and then a separate subdomain at with its own root folder on the server and it works.

Mee too, but then the federation URL is and the social URL (Mastodon) is

I would like to change it to and

I actually did it and it works. Problem solved. Thank you all.