Host nextcloud and apache2 webserver on same IP server with subdomain

Hello everyone

I have a nextcloud & apache2 server set up. Now I want to point the subdomain ‘nextcloud.mydomain.com’ to the nextcloud server while still having the main domain ‘mydomain.com’ pointing at my webserver/website. How can I do that?

I tried editing the virtual host but the subdomain ‘nextcloud.mydomain.com’ is always pointing at the webserver and not the nextcloud server.

This is what I added, but I’m not sure if I did it right:

<VirtualHost *:80>
        ServerAdmin admin@mydomain.com
</VirtualHost>

<VirtualHost *:60001>
        ServerName nextcloud.mydomain.com
        ServerAlias nextcloud.mydomain.com
        DocumentRoot /var/www/nextcloud/
</VirtualHost>

Thanks, Jan

Hello @janbo,

your question is about apache.
Please search the web or use official apache docs https://httpd.apache.org/docs/current/mod/core.html#virtualhost

1 Like

Yes, I know. I tried that but I couldn’t find exactly what I was looking for with apache therefore I tried my luck here. I was hoping someone might have had the same issue.

1 Like