Server alias for secondary domain

Hey everyone,

for a WordPress-Multisite installation I usually create pointer domains as “Server Alias”. I can do this via Siteworx or I can edit the vhost-primarydomain.conf file and add the ServerAlias.

But this won’t work, if the customer wants to use E-Mail on those domains (Pointer domains can’t be configured).

So I would have to set up the domain as a secondary domain. But how do I do the Server alias thing? Because now there is a vhost-secondarydomain.conf file for the secondary domain and editing the vhost file of the primary domain would be ignored.

Any ideas?

Cheers,

Michael

Hi Michael

I hope your well and business is good

I would think of 2 ways quickly

Either a rewrite rule or a redirect scrip

Both should do what you want I think

Many thanks

John

Hi John,

all is well, thanks. And you too, I hope?

A redirect can’t work, as the domain mapping within Wordpress Multisite is done via redirect and this would create a loop.
Afaik only a ServerAlias works.

Hi Michael
Many thanks, yes good thank you, I have 2 grandschildren stopping until the weekend. Makes you feel old…
I read your update yesterday, and was wondering of the following may help
I hope it helps and sorry of you have already seen or tried it
Many thanks
John

I was about to post a thread about this. I’ve been trying to get domain mapping for WPMU working for a week now with Interworx with no luck. If I add a domain to the account, it gives it its own public folder rather than pointing to the account’s original vhost. Neither domain addon/pointer/whatever option will work by default afaik. So… The answer would seem to be to create a secondary domain and then modify the vhost to point to the domain’s WP root. I haven’t tried this yet but if anyone can think of anything better, please let me know. I was hoping I could just add the domain and WP would take care of the rest but that’s not the case with Interworx. I’m really hoping to avoid having 100 WP installs but I’m not sure I’ll be able to avoid it in any practical way. I don’t like the idea of having to alter apache’s conf to circumvent an Interworx feature’s config.

I’d like to post a related feature request but I don’t seem to have permission to post in that section under siteworx. Feature would be something like “Ability To Add Secondary Domain Using Custom Path For public_html/VHost Config”

Hi Synthetisoft,

don’t add the domain as subdomain, add it as a pointer domain and choose “Server Alias” in the options there and let it point to the domain where you installed your WP. Then use this Domain mapppig plugin https://wordpress.org/plugins/wordpress-mu-domain-mapping/ and set it up according to their installation notes.

It works very well, all I want is NOT to use the Pointer domain/Server alias mechanism for completely different reasons. But it sounds as if this is what you are looking for.

Hope that helps

Michael

[QUOTE=mdeinhardt;28854]Hi Synthetisoft,

don’t add the domain as subdomain, add it as a pointer domain and choose “Server Alias” in the options there and let it point to the domain where you installed your WP. Then use this Domain mapppig plugin https://wordpress.org/plugins/wordpress-mu-domain-mapping/ and set it up according to their installation notes.

It works very well, all I want is NOT to use the Pointer domain/Server alias mechanism for completely different reasons. But it sounds as if this is what you are looking for.

Hope that helps

Michael[/QUOTE]

With that setup you’re not able to create emails and such? Is that what your problem is? Also, I will need to be using Let’s Encrypt for all the domains. Hoping that’s possible.

Hi synthetisoft

Feature has been closed, so no one can post on them

You now need to post your feature on the ideas webpage, where it is voted on (interworx.com/ideas)

I do not think I can help much here as we do not use wp and do not have spare domain names to test

Many thanks

John

Hi Michael and synthetisoft

As a small workaround, which should work I think but not ideal sorry

Create a new siteworx account called mail.mydomain.url, then edit the DNS and change mx record so it only shows mail.mydomain.url

The webmail would then be on mail.mydomain.url/webmail

The actual domain would be server alias on the wpmu domain (mydomain.url alias mywpmu.url

I think this may work whilst it is been discussed

Many thanks

John

Playing off John’s idea, I think you could create a siteworx account for the other domain.

Example:

Site1.com

  • The main SiteWorx accounting hosting wordpress
  • DNS points site1.com to IP 1.1.1.1

Site2.com

  • The additional wordpress account
  • No SiteWorx account setup
  • DNS points site2.com to IP 1.1.1.1 and VHOST server alias from site1.com accepts this website and then wordpress does its thing

Now you create a SiteWorx account for site2.com, just as if it was its own website.

Then you can either delete the site2 vhost file from “/etc/httpd/conf.d” or just make sure that site1.com’s vhost loads first by renaming it from vhost_site1.com.conf to vhost_000_site1.com.conf.

I’m not 100% sure this will work, but figure it’s worth a try…even if it is a bit hacky.

Server alias for secondary domain

Hi Justin, Michael and synthetisoft
I hope your well
I was thinking about this, and as I statd, I do not use WPMU, but are we overthinking this if all that is been asked is for email on a server alias name… also, cpanel require the domain used to be a parked domain, so I do not think cpanel would give email facilities to a parked domain.
My thought now is, just manually create the email account(s) required, and for webmail, use server domain.
Obviously, you would not see a siteworx account for server alias, but you would have access to webmail, pop, imap and smtp, and the MX DNS woudl be correct as it points to your server.
you would need to SSH into server, and run the following, replacing domain.url with correct domaina and replace password with your new strong password.
This would create a postmaster@domain.url, then you manually create new email addresses required.
/home/vpopmail/bin/vadddomain domain.url password
/home/vpopmail/bin/vadduser new-user@domain.url password
The account is then located at /var/vpopmail/domains (you will see new domain listed)
I have not tested this in production, and if used, you use at your own risk, as there may be good reasons not to use the above as a quick fix
For SSL LE, I am not sure, I guess it would be possible, and there is a WPMU SSL plugin, but I have not tried it as we do not use WPMU sorry

The drawback to above is it would not count in quotas
I hope that helps a little
Many thanks
John

Another, less hacky idea, compared to my other one.
You put the wordpress site and the email only site on different IPs on your server.

site2.com A record will point to the site1.com IP and hooked into the site1.com account via the server alias.

site2.com MX (let’s say mail.site2.com) would point to the site2.com IP address.

UPDATE

In order to achieve this, you would have to manually add the server alias to vhost of site1.com as SiteWorx won’t allow it because it already exist on the server.

  1. So you have site1.com running with no alias to site2.com
  2. You setup SiteWorx account for site2.com
  3. You manually edit site1.com VHOST with server alias of site2.com

This idea could be used for multiple separate multiWP sites, by just using two shared IPs on your server.
So really you are only losing 1 IP in your block for this setup, pretty good trade off.

…if it works that is :smiley:

Hi Justin

Sounds good but IW recognises the domain is already present on server

I’m sorry though, I may have misunderstood, so I apologise in advance

Many thanks

John

Right, if you do it in SiteWorx, good point.

But I think if you create site2.com account, then go back and manually edit the vhost file it will work.

I’ll update my other post to reflect this.

Hey guys,

first off, let me tell you I love you (resp. your willingness to help). I’ve been out-of-office a few days and coming back, I find you have put a lot of thoughts into my problem. Thank you very much !!!

I went through all the suggestions and here are the results:

JOHN: Create a new siteworx account called mail.mydomain.url, then edit the DNS and change mx record so it only shows mail.mydomain.url

This won’t work, since the email address would then be user@mail.mydomain.url instead of user@mydomain.url. Or did I get you wrong, John?

JUSTIN: manually add the server alias to vhost of site1.com … either delete the site2 vhost file … or just make sure that site1.com’s vhost loads first

This works, but since we edit the vhost file manually, any change to the domain settings (add subdomain etc.) will remove the manually added vhost entry. It would be ok as a temp solution, but is way to error-prone for a permanent solution. No matter how detailed our documentation would be, in a few months or even years, this WILL lead to confusion and angry customers :wink: So I would prefer a more fail-safe way.

JOHN: manually create the email account(s) required, and for webmail, use server domain

This seems to be a viable solution, but it doesn’t work for me :frowning: When trying to create the domain via “/home/vpopmail/bin/vadddomain domain.url password” it says the domain already exists. But when I try to add the mail account via “/home/vpopmail/bin/vadduser new-user@domain.url password” I get

vmysql: sql error[2]: Data too long for column ‘pw_clear_passwd’ at row 1
Failed while attempting to add user to auth backend
Error: no authentication database connection

I am hoping this is just some error on my part or something we have forgotten. Any ideas?

Cheers,

Michael

Hi Michael

Many thanks, there are a lot of very experienced users who help, and Justin is one of the very best I think.

I have retried just adding domain into qmail only, but I think you need to add the qmail domain first, then add the domain as a server alias

Please see pics, lets say using master.url as the WPMU account, and s-alias.url as the server alias account.

I will not install WPMU, as you know this works, so I will just create a sitewrox account called master.url, then add s-alias.url to qmail, for email only, with first been postmaster@s-alias.url and the an actual user email account called itsme@s-alias.url,then create a server alias called s-alias.url to master.url, then test using webmail, using the server hostname as serverhostname.url/webmail

Warning - Please Note

s-alias.url will NOT count in space quota used for master.url, as it is created outside of the siteworx account.

I hope that helps, and I hope you can follow the above easily

Many thanks

John

2.png

3.png

Hi John,

it works. The “existing domain” message should have given me the hint to first create the mail account and then add the pointer domain as server alias. But it was late yesterday night, so that’s gonna be my excuse :wink:

I encountered the same error message as above, but this time while adding the domain

vmysql: sql error[2]: Data too long for column ‘pw_clear_passwd’ at row 1
Failed while attempting to add user to auth backend
Error: no authentication database connection

So I had to remove the domain again with

/home/vpopmail/bin/vdeldomain domain.url

and then added it with a shorter password. That worked and adding the mail account with a similar short password worked fine to. After re-adding the pointer domain and an Apache restart everything works now as intended. Excellent!

Does anone have any idea, why the password length seems to be limited and to what length?

I looked up the docs for Vpopmail here http://www.qmailwiki.org/Vpopmail and will try a few more things. Especially the “vaddaliasdomain” intrigues me, I have to play with that and see what it does. If it does what I think, this could be a very convenient way to “create” the mailaccounts we need.
As for the quota issue, I could solve that two ways. Use either the option -q quota_in_bytes (sets the users quota, use NOQUOTA for unlimited) while adding the user or I could move the domain folder from /var/vpopmail/domains into the siteworx account folder and create a symbolic link, just like siteworx does it. Or combine both in order to limit the mail account and add it to the space quota of the siteworx account. But in our case I don’t really need it, just wanted to tell others, that might need it.

One more thing: I tested the vuserinfo command and also tried /home/vpopmail/bin/vuserinfo -C user@domain.url and that gave me the unencrypted password I entered before. This sets of all alarm bells in me. Shouldn’t vpopmail be configured with the option --disable-clear-passwd by default? This is exactly the kind of oversight, that makes leeching user data from hacked servers so easy and attractive. Or am I wrong?

Anyways, thanks a lot John and Justin, you helped me a lot.

I tried the vaddaliasdomain thing and it is awesome. I simply add the alias like this

/home/vpopmail/bin/vaddaliasdomain real_domain alias_domain

and it maps every mail account, every forwarder, every autoresponder from the original domain to the alias domain. Users “share” the account. i.e. info@original_domain.url and info@alias_domain.url can each login under their username and the same password, each can send and receive under their user name (= email address) and all mails end up in the same inbox.

This might not be desirable for many, but for the way we use WPMU it is perfect. We have a few customers each running a few websites, so we set those up as multisite installations in order to reduce administration overhead.

I can now add each domain first as pointer domain/server alias and map it in WPMU and with vaddaliasdomainmail I can add each alias domain for email. Most companies have a similar set of standard mail account like info@domain.url, admin@domain.url and so on and those are now automatically available for each alias domain.

Yay!

So with the vaddaliasdomain it’s basically a forwarder to the main domain for all email accounts on the main domain? Just allowing the main to also except email for the other? Does this cause any issues with replying to emails as the correct domain user?