Zentyal Forum, Linux Small Business Server

Zentyal Server => Installation and Upgrades => Topic started by: przemekz on November 06, 2013, 11:06:13 am

Title: [Solved]Second domain on Zentyal
Post by: przemekz on November 06, 2013, 11:06:13 am
Hi, I wish use Zentyal as www serwer.
I configured main domain and everything works perfectly.

But I want to add next domain. And I don't now, where can I upload my website?
When I have one domain, I suppose,  /var/www/html. But how can I configure more than one website.
Title: Re: Second domain on Zentyal
Post by: ctek on November 06, 2013, 11:17:52 am
Did you add a second domain in DNS ? If not you wil have to add another domain seconddomain.com.
After that go to webserver and add a new host. www.seconddomain.com
After this, the root folder will be in /srv/www/www.seconddomain.com

Regards.
Bogdan
Title: Re: Second domain on Zentyal
Post by: przemekz on November 06, 2013, 02:08:43 pm
I add second domain in DNS. But I didn't see in var.

I will check later, now I don't have access to serwer.
Title: Re: Second domain on Zentyal
Post by: christian on November 06, 2013, 02:28:04 pm
Domain, DNS, /var/www/html.... ???

One more example of how confusing this domain word can be when this is in fact matter of virtual host and CNAME (host) entry in DNS.

As ctek rightly explains (and this is another confusing aspect from my standpoint, although in another direction) standard web content is stored in /var/www but vhosts created using Zentyal GUI expect web content to be stored in /srv/www/yourvhost
As far as I understand, there is no need to create any DNS entry but, for what I've experienced few days ago working on another configuration, check twice DNS content as created by Zentyal on your behalf because some IP addresses might be missing for host records.
It also sometimes creates strange domain entries  :-X
Title: Re: Second domain on Zentyal
Post by: przemekz on November 07, 2013, 09:54:08 am
It strange.

During install, I set external domain. Now I added second.

In var/www/html i have only index.html

I don't have also /srv/www/. I have srv/ftp only
Title: Re: Second domain on Zentyal
Post by: ctek on November 07, 2013, 10:45:39 am
You will have to add a new host in the webserver section.
Click the add button, add the new name like www.your-second-domain.com and then click save changes
the folder www will be added in the /srv/ folder

Best regards
Bogdan
Title: Re: Second domain on Zentyal
Post by: przemekz on November 07, 2013, 01:34:24 pm
But what whith DNS, For examle, I added domain pozyczki-olawa.com.pl to DNS (as domain). And when I added pozyczki-olawa.com.pl, zentyal add domain com.pl to DNS.

I don't want to make any mistakes, so its correct, or should I add anly virtual host?? Delete first second domain
Title: Re: Second domain on Zentyal
Post by: christian on November 07, 2013, 01:45:42 pm
I also quickly notice some strange behaviour while remotely installing Zentyal for a friend of mine at the time I configured vhost.

Based on what you describe, if your goal is to reach pozyczki-olawa.com.pl web server, what you have to understand and define is what your DNS domain is.
If your domain is pozyczki-olawa.com.pl, then reaching http://pozyczki-olawa.com.pl is a short-cut from http://whatever.pozyczki-olawa.com.pl
In order to achieve this, DNS must contain a "default" record so that any request not matching any existing A or CNAME is redirected to this default IP.

If you create pozyczki-olawa.com.pl using vhost Zentyal interface (webserver section), then Zentyal is (rightly) thinking that your domain is com.pl while your hostname is pozyczki-olawa

Still you can manually edit DNS content isn't it?
Title: Re: Second domain on Zentyal
Post by: przemekz on November 07, 2013, 01:57:25 pm
So, when I first add domain in Zentyal and later added virtual host, I have srv/www/domain. And everything is ok. But zentyal created own domain in dns.

Now. I deleted everything. Then I added pozyczki-olawa.com.pl to virtual host. ThEN zentyal created new domain. com.pl. I change name of this domain and I thing everything is ok. Am I right?
 
I am not sure do I correctly understand this: In order to achieve this, DNS must contain a "default" record so that any request not matching any existing A or CNAME is redirected to this default IP.


And I have next question. I have ftp access (with admin passwd) to zentyal. I can open /srv/www/pozyczki-olawa.com.pl. But I cant copy any files (for example via filezilla → 553 Could not create file.) How can I fix permissions/
Title: Re: Second domain on Zentyal
Post by: christian on November 07, 2013, 03:05:55 pm
Now. I deleted everything. Then I added pozyczki-olawa.com.pl to virtual host. ThEN zentyal created new domain. com.pl. I change name of this domain and I thing everything is ok. Am I right?

Starting from scratch (meaning with no vhost nor any domain), if your create pozyczki-olawa.com.pl vhost, then Zentyal will check if domain com.pl domain exists and it doesn't, it will create it then Zentyal will also create host record pozyczki-olawa in this domain.
The only bug here is that host is created without any IP address. I don't know why  ::)
But except adding IP to this host, you don't have to edit anything else.
 
Quote
I am not sure do I correctly understand this: In order to achieve this, DNS must contain a "default" record so that any request not matching any existing A or CNAME is redirected to this default IP.
This is because I suppose my tries to explain difference between vhost (which means virtual host) and domain are unsuccessful. You still want to create "domain" and access "domain" instead of accessing service or server at your domain.
As a result, web browser, while trying to reach your website, will try to find either A record or CNAME matching the leftest part of your URL. As this doesn't exists, name resolution process will return the default IP for the domain.

It works...  ;) this is your own choice and I can understand that your are, like plenty of other people, confused because you are used to think, when you access URL, that the left part is a domain.... side effect of Microsoft literature  ???  I don't know  :-X


And I have next question. I have ftp access (with admin passwd) to zentyal. I can open /srv/www/pozyczki-olawa.com.pl. But I cant copy any files (for example via filezilla → 553 Could not create file.) How can I fix permissions/
[/quote]
Title: Re: Second domain on Zentyal
Post by: przemekz on November 07, 2013, 06:24:05 pm
Thanks for your help. I'm beginning my adventure with server.

Now I have 2 domains.  Main and pozyczki as host (and in dns as I said). I hope it will be work... ;
Title: Re: Second domain on Zentyal
Post by: przemekz on November 08, 2013, 05:25:18 pm
Something is wrong.
In my internal network domain works. But I have some errors in external.

I thing i should read more about zentyal and domains...
Title: Re: Second domain on Zentyal
Post by: christian on November 08, 2013, 06:18:28 pm
Perhaps about domain only first. I mean this is not linked to Zentyal implementation.

What do you mean about "external" ?
And what is your problem then ?
Title: Re: Second domain on Zentyal
Post by: przemekz on November 08, 2013, 09:27:08 pm
When I use pozyczki-olawa.com.pl in my home network, its worked. When I use www.pozyczki-olawa.com.pl in other networks (for example via phone) its doesnt work.
Title: Re: Second domain on Zentyal
Post by: christian on November 09, 2013, 12:35:30 am
From internet, in order to be able to reach http://www.pozyczki-olawa.com.pl, this requires that publish DNS (the one authoritative for pozyczki-olawa.com.pl domain) declares that WWW server (either A or CNAME record) can be reached using your public IP address.
This is the standard (normal) way.

Another alternative approach is to declare, for this domain, default entry that will catch www and also any other "host" to be redirected to your pubic IP (we have discussed this few post above already).

Unless Zentyal domain is authoritative for your domain (this would mean that for your domain ns server is Zentyal) all above stuff has to be maintain in external DNS, not in Zentyal. Most of the time this external DNS is managed by your registrar, with perhaps interface available so that you can do it for your own domain.
Title: Re: Second domain on Zentyal
Post by: przemekz on November 16, 2013, 10:42:14 pm
So I have two domains now.
www.favor-centrala.pl and www.pozyczki-olawa.com.pl

First domain I added during installation. And its works. for example I use zarafa via this domain. I want to install some www on this domain.
In /var/www i have only index.html.

My registar configured dns etc... I think both domains give me the same thinks (zarafa and others thinks).  Just before I added second domain.

I really don't now how can I divide domains. I want to have others www. And my question is. How Can I do It. Maybe something is wrong in my registar,
Title: Re: Second domain on Zentyal
Post by: przemekz on November 16, 2013, 10:59:23 pm
You will have to add a new host in the webserver section.
Click the add button, add the new name like www.your-second-domain.com and then click save changes
the folder www will be added in the /srv/ folder

Best regards
Bogdan

I think this method is worked. I check domain on my mobile (via gsm). And www.pozyczki-olawa.com.pl works. But Can I deleted form DNS domains pozyczki-olawa.com.pl and rename com.pl to pozyczki. And I see if I create domains via webserwer, in com.pl there are new hosts.

Maybe I can add domains via dns and add new host.

And the last question. www.pozyczki works. but pozyczki-olawa.com.pl (without www) doesnt work. I see  apache It works, instead www.


---------------
I change method. I didnt add domains via DNS. I added only virtual host. I put www.pozyczki-olawa.com.pl. And ebox create domains pozyczki-olawa.com.pl in DNS. www.pozyczki-olawa.com.pl works in internet (and home network. You can see.
But why http://pozyczki-olawa.com.pl/ doesn't work
Title: Re: Second domain on Zentyal
Post by: christian on November 17, 2013, 04:04:35 am
What you should perhaps do is to ask someone speaking your native language to translate this thread for your (you may try using translate.google.com or babelfish) because I already explained think this to you here: this is a matter of "domain IP" resulting in "*" record in DNS.

edited: typo  :-[
Title: Re: Second domain on Zentyal
Post by: przemekz on November 17, 2013, 10:51:55 am
OK. OK.
But why works www, but without www doesn't work
Title: Re: Second domain on Zentyal
Post by: christian on November 17, 2013, 11:11:36 am
because I suppose you created vhost  like www.your-domain.com and this, as I explained previously, creates DNS domain if it doesn't exist already and also creates host entry within this DNS zone.
Did you look at your DNS zone content already ?
Title: Re: Second domain on Zentyal
Post by: przemekz on November 17, 2013, 02:50:39 pm
Ok,
when i add www.pozyczki-olawa.com.pl, zentyal add to dns pozyczki-olawa.com.pl. And hosts: www.pozyczki.olawa.com.pl (empty IP), www (empty IP) and Favor (name of my host with my IP).

Maybe i should delete favor and add pozyczki-olawa.com.pl to dns (i tried but nothing is change), and add my IP to domain??
Title: Re: Second domain on Zentyal
Post by: christian on November 17, 2013, 03:18:38 pm
Sorry, I can't really help further  :-[
I already tried using different wording and sentences to explain what domain and A or CNAME records are and how URLs use it, including the default domain idea but I don't have any other idea that could make you understand if this is not already clear enough.
Perhaps someone else with better English and different wording can succeed  ???

On top of this, although you don't clearly state it, you are making things even more complex because you do not focus on internal behaviour first (I mean access from you LAN) but try to check it in parallel from internet that will require to modify external DNS content (assuming, which I strongly hope, that your Zentyal DNS is not exposed and used on internet).

My very last suggestion is that you stop any change for the time being, do your home work to understand a bit more about DNS then read this whole thread again with this new understanding before coming back on Zentyal interface.

Sorry  :-[
Title: Re: Second domain on Zentyal
Post by: przemekz on November 17, 2013, 03:59:22 pm
No problem. Thanks for your help. I register zentyal trial, so I think I can give access from internet, but of course not in public place ;)
Title: Re: Second domain on Zentyal
Post by: przemekz on November 17, 2013, 10:51:40 pm
So.

In DNS I have domain pozyczki-olawa.com.pl
Domain IP Addresses : 109.207.60.174 and 192.168.1.1 (the same as main domain)
Nazwy hosta (host names??) → Favor (create when I created new domain, with the same IP) and www (with empty IP and create by webserwer)
MailExchange → empty
DNS → Favor (my main DNS), created when I added new domain
TXT records → empty
and last column, services (uslugi) → There is not any SRV record
aha and dynamic domains → no

Maybe this informations help
Title: Re: Second domain on Zentyal
Post by: christian on November 18, 2013, 06:22:59 am
In DNS I have domain pozyczki-olawa.com.pl
Domain IP Addresses : 109.207.60.174 and 192.168.1.1 (the same as main domain)
remove 109.207.60.174 that is your external IP, not required here.

Quote
Nazwy hosta (host names??) → Favor (create when I created new domain, with the same IP) and www (with empty IP and create by webserwer)
Here is the point you have to pay attention to. Multiple solutions work, depending on what you intend to do:
1 - the easiest: modify www record to add 192.168.1.1 IP
2 - expected solution if same IP is used: remove www record and edit favor record to create alias (www)

Quote
MailExchange → empty
DNS → Favor (my main DNS), created when I added new domain
TXT records → empty
and last column, services (uslugi) → There is not any SRV record
aha and dynamic domains → no

Do not change anything here.

These settings are used when accessing your vhost from your LAN (only)
Title: Re: Second domain on Zentyal
Post by: przemekz on November 18, 2013, 06:48:18 am
Thanks. I changed as you write.

But nothing is change.
www.pozyczki-olawa.com.pl works (little change, now works in lan and in internet, earlier only in Internet)
http://pozyczki-olawa.com.pl doesn't work.

Maybe I should create vhost pozyczki-olawa.com.pl instead www.pozyczki-olawa.com (and then set alias www?? or add www host??)
Title: Re: Second domain on Zentyal
Post by: christian on November 18, 2013, 07:11:09 am
www.pozyczki-olawa.com.pl works (little change, now works in lan and in internet, earlier only in Internet)
this is expected  ;)

Quote
http://pozyczki-olawa.com.pl doesn't work.
This works now at DNS level.
However (now that I understand better what you try to achieve  ::)) it doesn't work at Apache level because you are using vhost that requires some customization. The way vhost works s that it will redirect HTTP requests to the right place depending on URL.
Apache default web site will handle everything else.

- if you create www.pozyczki-olawa.com.pl  vhost, only http://www.pozyczki-olawa.com.pl will work
- if you create pozyczki-olawa.com.pl  vhost, only http://pozyczki-olawa.com.pl will work

Notice that you can create both (in term of vhost) and then align DNS content manually as both will require only one DNS domain that will contain both "domain ip" and www alias for favor host in this domain but, because Apache vhost config files are handled by Zentyal, this will require some modification there so that both point to same web content. I suppose the easiest way to achieve this is to create symlink to the target directory. (I don't know with 3.2 but 2.2 is not very flexible from this standpoint).
Title: Re: Second domain on Zentyal
Post by: przemekz on November 18, 2013, 08:52:25 am
But If I want do create two vhost, I have 2 catalog and I should add 2 sites content. The same. Very easy, when I use static www.

But what when I want to use, for example joomla...
Title: Re: Second domain on Zentyal
Post by: christian on November 18, 2013, 09:32:53 am
you can create as many vhost as you want with different content.
If www.pozyczki-olawa.com.pl  and pozyczki-olawa.com.pl are different web sites, just create these different vhost as you will need both. I can't see where problem his  ???

One aspect is to understand what happens at DNS level and when DNS is involved.
Then once network layer is under control, there is another step that is the application layer, here Apache, that brings its own rules and constraints.
Of course, at the end, everything needs to be aligned in order to smoothly work  ;)
Title: Re: Second domain on Zentyal
Post by: robb on November 18, 2013, 09:35:25 am
You can install joomla or any other CMS in the directory of the vhost
If you choose the vhost name to be joomla.domain.tld, copy the joomla install files to /srv/www/joomla.domain.tld directory and follow the install instructions for joomla

I have cmsmadesimple as cms running in a vhost and chamilo electronic learning environment. Almost any webbased application that can be installed on Ubuntu 12.04 Server, can be installed on Zentyal too.

Keep in mind that the vhost is just a container for the website or webapplication you want to host on your Zentyal server. The content of a vhost is completely for you to choose.
Title: Re: Second domain on Zentyal
Post by: przemekz on November 18, 2013, 10:39:46 am
hm. language... ;)

I now this. But I would like use joomla both adress http://domain and www.domain. So, when I use html page, I cant use 2 copys/ 2 vhosts. And everything is ok. Maybe I can use other methods to use both adress. Some kind of alias or link??
Title: Re: Second domain on Zentyal
Post by: christian on November 18, 2013, 11:13:49 am
yes, this is a language issue because I don't understand what you mean.
Can't you take some example that could clarify what you target ?
Title: Re: Second domain on Zentyal
Post by: robb on November 18, 2013, 11:40:09 am
You can do a trick with a redirect here.
Create both vhosts,
If you want joomla in www.domain.tld then install joomla in the corresponding directory under /srv/www
In domain.tld you put a redirect index.html file which only contains:
Code: [Select]
<head><meta HTTP-EQUIV="REFRESH" content="0; url=http://www.domain.tld/"></head>
I someone goes to http://domain.tld this index.html redirects immediately to http://www.domain.tld

I you want to have different content in www.domain.tld and domain.tld then you can just create both vhosts and put different content in the directories of the 2 vhosts under /srv/www
Title: Re: Second domain on Zentyal
Post by: przemekz on November 18, 2013, 11:46:55 am
yes yes yes. This is e beatifull sollution.

Last question. Can I delete domain com (after add pozyczki-olawa.com.pl vhost). I like order.


And answer to christian (w create a long time ;)

Overall, my point is how to make everything work even though both addresses on one site. I can do two virtual hosts, but it means that two times I have to upload the same content. And I do not want to do that. For if in classic web pages in html no problem. With so much in that Joomla is a problem. Because, as will later change the content.

Off course I already have a solution ;)
Title: Re: Second domain on Zentyal
Post by: robb on November 18, 2013, 12:01:17 pm
If there is no content that you need in domain com, you can safely delete that vhost.
Check in Infrastructure/DNS if the entry for that vhost is deleted too. If not, delete it manually.
Title: Re: Second domain on Zentyal
Post by: christian on November 18, 2013, 12:08:00 pm
yes yes yes. This is e beatifull sollution.

Almost everything goes here.
Redirect, HTTP 301 or 302 or even, as I wrote, symbolic link.
Each has pros & cons. Up to you.


Quote
Last question. Can I delete domain com (after add pozyczki-olawa.com.pl vhost). I like order.
??? can you explain again ??? what does this mean? Which one domain ?


Quote
Overall, my point is how to make everything work even though both addresses on one site. I can do two virtual hosts, but it means that two times I have to upload the same content. And I do not want to do that. For if in classic web pages in html no problem. With so much in that Joomla is a problem. Because, as will later change the content.
This was my question !
What is your goal at the end ? This is clear now: single web content reached using different URLs that are not handled by Apache basic configuration but instead vhosts.
Same as your first point in this post then and same as already discussed in post # 26.

As explained by Robb, REDIRECT works. Symbolic link is another suitable solution. HTTP 301 can be used too (better than 302 here BTW).

No willing to generate more fuzz and misunderstanding, notice that now I understand better, same can be achieved (although this might not be easy with Zentyal due to the way conf files are managed), with basic Apache conf listening on different IP dedicated to your alternate domain. The real blocking point here could be public IP allocation however. So this is only for your own understanding, not proposal for further implementation  ;)