Hi,
I am hosting a nextcloud server for personal use and would like to run a personal webpage on the same server. I have tried to edit the config files for virtual host but with no luck.
I have to dns names “mynextcloud” and “personalpage”
What get is when I try to access “personalpage” is 401 or if I try to access “https://personalpage” i get to the “mynextcloud”.
I’m biased, but that’s the kind of thing the UBOS Linux distro was made for: run any number of apps, including Nextcloud, in parallel at the same virtual host or at different ones, all without editing config files at all. No strange port numbers required either.
You just need two different virtual host sections. One complete/full section for each domain. Both can run on the same port. You should not need the redirect statement. You also have not included ssl config in the virtualhost section.
I have edited both 000-default.config and 000-default-le-ssl.conf but still https://www.mywebpage.com is directing me to my nextcloud page. Is nextclpud taking all requests and directing it ti nextcloud. From what I have understood its “only” to add a virtual host but that does not seams to work.
Have tried all different ports; 80, 443, 81. Think the problem lies somewhere else, might be something with secure http for nectcloud, forgot to mention that I used certbot to secure the connection to my nextcloud.
I changed the RootDirectory for mycloud VirtualHost block to the directory of mywepage and I can access “mywebpage” from the url mycloud. The order och the block does not matter either.
Then I do not understand. You need to have a proper apache setup to serve the correct files. That has nothing to do with Nextcloud.
In your first post you show two domain named mynextcloud.com and personalpage (without .com?)
You should not use the rewrite rule in any of them.
VirtualHost statements work with SNI. This means that Apache will look at the browser’s request to determine what domain name (virtualhost section) to serve documents from. Your SSL certificates must be correct.
Use a separate config file for your hosted domains. Usually under /etc/apache/vhosts.d/somedomain.conf
Your configuration should look like this, assuming you have two domains mynextcloud.com and personalpage.com. There should be no need for any rewrite rules. Those are usually needed if you want to redirect from HTTP to HTTPS. In that case it should be under a separate <VirtualHost *:80> section.
In your first post you show two domain named mynextcloud.com and personalpage (without .com ?)
A typo, it should be a .com after personalpage.
It sounds like you might be running Nextcloud on your_default_vhost(000-default.config + 000-default-le-ssl.conf)which is usually not what you want.
That is correct, I have now changed it to be one one cloud.conf and one personalpage.conf and have them enabled and disabled 000-default.config + 000-default-le-ssl.conf.
What I failed to mention before is that cloud.com is using https certified by certbot while a added personalpage.com after https is enabled. Personalpage.com use http.
What I find weird is that I am able to ping personalpage.com but not able to reach it in my browser. As well as when I type in my browser http://personalpage.com I get redirected to cloud.com.
It should not redirect to Nextcloud unless there are some files in /var/www/personal/ that says so, or you have something in your apache config doing the redirect.