Wordpress & Nextcloud redirections under UCS 4.4

wordpress
nextcloud

#1

Hi everyone,

Is there a How-to or similar to show me how to redirect the URL from /worpress and /nextcloud for their own subdomains?

For example, the default ones for UCS system are:

myserver.mydomain.tld
mydomain.tld
www.mydomain.tld

So, Wordpress and Nextcloud work under those URLs as:

myserver.mydomain.tld/wordpress
mydomain.tld/wordpress
www.mydomain.tld/wordpress && /nextcloud

But I wish to accomplish this:

www.mydomain.tld --> as the Wordpress URL
cloud.mydomain.tld --> as the Nextcloud URL

How can it be done?

Regards.
JG


#2

Hi @mag007,

Well the first part

is very easy as long as you can live with a redirection:

www.mydomain.tld --> www.mydomain.tld/wordpress/

you just use:

ucr set apache2/startsite='wordpress/'

For nextcloud you can find solutions in forum. There is a how-to for a template:


This worked by the time I wrote the template (and it is still working for me) but it might be possible that there is now - with a fresh install - a Nr. 5 todo. Look here: Nextcloud reverse proxy

You will find other posts regarding this too in the forum (if you hesitate to use a template).

Best, Bernd


#3

Hi Bend, and thanks for the reply.

Regarding the redirections, I cant live with them as long as I can have portal access.

So, for the first part of my post I think I passed the wrong idea, as I don’t want to redirect the ‘root’ URL to the /wordpress one, but instead the way around.

I want to use one of the available URLs, the ‘www.mydomain.tld’ to point to the /wordpress.

Basically the only URL I want to keep in order to manage the UCS server is the one that points to its own name :: myserver.mydomain.tld.

Is this doable?

Thanks in advance for the support.

Regards, JG


#4

Hi @mag007,

it is an apache webserver so the answer to your question:

I would say - it should be. But I’m not sure were I would begin… The UCS-Portal seams quite advanced regarding the apache-setup.
On the other hand with a second domain-name my2domain.tdl it should be easy to achieve something like:

www.my2domain.tdl -> wordpress
cloud.my2domain.tdl -> nextcloud
having still
*.mydomain.tdl -> UCS Portal

Perhaps it isn’t that difficult to make this work too with one domain but you would need to rewrite some univention templates as the default is - whatever server-name - the server will serve the Portal below /univention/ on the listening IPs.
You will have - even in the simple setting with a second domainname - make a rewrite-rule for the second domain like *.my2domain.tdl -> www.my2domain.tdl.

Long story short: if it is essential that you have only one subdomain for the Portal, you will have to adjust the univention-template files and move (at least) the line:

IncludeOptional /etc/apache2/ucs-sites.conf.d/*.conf

in both 000-default.conf and ssl-default.conf to a new apache-conf designed for the UCS subdomain.

BR, B


#5

Thank you Lebernd, for your insights.

I only own one domain, so using my2domain.tld isn’t a option for me.
I’m using my own private domain to test this system capabilities in order, if possible, to replace a Zimbra FOSS, for a client that o give some support. Nowadays it’s giving me more headaches with the EAS implementation that I want to.
I’ll check and try your advises, thank you for those.
Best regards.
JG


#6

I am not sure if this is really true. Afaics there is no servername specified in the vhost serving the portal, therefore the portal will be shown with any http request not specifying a servername configured for any other vhost.

So to have a dedicated vhost for WordPress or nextcloud you just have to create one. (you still likely need to adapt at least nextcloud so that it’s aware that it is OK to be served from this specific domain).


#7

actually that’s what I’ve intended to say :slight_smile:
So first approach could be to - not deleting or moving the IncludeOptional-line - but instead adding a servername to the mentioned files and proceed from there on.


#8

Making manual modifications to files within ucs means that sooner or later these files will be reset to their original state. Instead a new vhost file should be created either including the current configuration or copying relevant parts.


#9

Thank you all.

The VHOST approach is more what I was looking for, based on some searches on the Net.
But, so far, I couldn’t find a suitable one for that, or, I’m looking wrongly.
If not ask too much, is there any info/guide you can provide in order to accomplish this task ?
Regards.
JG


#10

Well it is true - if you just edit the files default-ssl.conf etc. They will be soon overwritten. But if you change the files in the header and commit them, new templates will first be installed as *.dpkg-dist-files. And you will get a notice if you run system diagnostics after an update.

That being said - the way could then - if not messing with template files - be:

  • install the letsencrypt-app - you wanted to use that anyway? Can you use it in your test environment?
  • If you chose to enable the certs for http-service you will get perfectly writen vhosts in the file: /etc/apache2/sites-available/univention-letsencrypt.conf
  • copy the disired vhosts to single file(s) - one for each service.
  • delete of course the line IncludeOptional /etc/apache2/ucs-sites.conf.d/*.conf in the vhosts that should not point to the portal.
  • if you have already installed the nextcloud and wordpress-app you will see the (unchanged) proxy settings for them too. Perhaps you can also live with something like cloud.mydomain.tdl/nextloud then you won’t have to ajust nextcloud config in the docker.
  • disable the http-service in the letsencrypt-app
  • enable your new copy-paste-edit-conf-file(s)
  • disable default-ssl.conf and the port 80 file (?). (Perhaps something needs to be running on this port to for a working letsencrypt setup)

Missing? A general redirect to I guess www.mydomain.tdl would perhaps be nice.

This all is assuming there won’t be a default a2ensite-command on update… :thinking:
(apache reload seams more accurate for everything that is not a new install or a really big change in the Portal)

It is not tested - I’m not sure if this affects SAML if you need it. This is just looking at the existing files on my setup.


#11

Hi,
Your help is not forgotten, and thak you for the suggestions.
I’m dealing with my huge mail migration to this box, so this is kinda stand-bu for now.
I ll get back to this and keep you posted.

Regards.
JG