Subdomains & Cluster

Hi All,

I wanted to know if anybody has a workaround to let site admins make subdomains and pointerdomains, since it’s disabled in siteworks when it’s clustered.

I’m not sure about the subdomains, but with the pointer domains, it’s possible although not supported, by editing the /etc/httpd/conf.d/domainname.com.conf file via command line on the cluster manager and EACH NODE and adding a ServerAlias line for the pointer, ie:

ServerAlias newdomain.com www.newdomain.com ftp.newdomain.com

and then saving that file and restarting apache:

service httpd restart

NOTE: This needs to be done on the cluster manager AND ALL nodes, as stated above.

Obviously, this would need to be done by the server admin. There is no way at this time for site admins to do so, but will be in a future cluster release.

Hmmm… so next step will be making a cron which copies this to all the nodes…
Well thanks, at least that’s something. I got new customers on our new cluster moaning all day long about subdomains.

you brought me on an idea…
If I have for example “domain.com” (man how original) and I want to have “sub.domain.com” as a subdomain (also very original).
Then I should be able to do that with making a conf file in /etfc/httpd/conf.d called “sub.domain.conf” with the following contence:


[SIZE=1]<VirtualHost 83.149.68.198:80>
SuexecUserGroup domainco domainco
DocumentRoot /home/domainco/domain.com/sub
ServerName sub.domain.com
ServerAlias sub.domain.com <a href="http://www.sub.domain.com">www.sub.domain.com</a>
ServerAdmin [EMAIL="webmaster@domain.com"]webmaster@domain.com[/EMAIL]
# subdomain logic
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} !^www\.sub\.domain\.com [NC]
RewriteCond %{HTTP_HOST} !^sub\.domain\.com [NC]
RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-]+)\.sub\.domain\.com [NC]
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
RewriteRule ^([0-9A-Za-z-]+)\.sub\.domain\.nl/?(.*)$ %{DOCUMENT_ROOT}/$1/$2
# end subdomain logic
ErrorLog /home/domainco/var/domain.com/logs/error.log
CustomLog /home/domainco/var/domain.com/logs/transfer.log combined
php_admin_flag engine On
# cgi: 1 don't edit between this and the "end cgi" comment below
<Directory /home/domainco/domain.com/sub>
AllowOverride AuthConfig FileInfo Options Limit Indexes
Options +ExecCGI
</Directory>
ScriptAlias /cgi-bin/ /home/domainco/domain.com/sub/cgi-bin/
# end cgi
</VirtualHost>
[/SIZE]

I will have to create the directories “/home/domainco/domain.com/sub” and “/home/domainco/domain.com/sub/cgi-bin” off course and add the A record and www CNAME record to the zone…
And then copy the contens of “/etc/httpd/conf.d” to for example to “/home/conf.d” on the manager (with a cronjob) and then copy the contence of “/home/conf.d” to the nodes’ “/etfc/httpd/conf.d” map with a cronjob.
But I’ll be all set then or not?

Only thing I guess I missed something here is what I have to do with this line:

RewriteRule ^([0-9A-Za-z-]+)\.sub\.domain\.nl/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]

By the way, what is the reason that it’s disabled for clusters?
Is it because the stuff in “/etfc/httpd/conf.d” on the master doesn’t get transfered to the nodes or something?

An other option where I’m thinking about is adding the subdomain to the ServerAlias:

ServerAlias domain.com <a href="http://www.domain.com">www.domain.com</a> <a href="ftp://ftp.domain.com">ftp.domain.com</a> <a href="http://www.sub.domain.com">sub.domain.com www.sub.domain.com</a>

Add the A and CNAME record to the zone, create a directory in the /html map of the domain. /html/sub for example and than add this to the .htaccess file in /html:

[SIZE=1]
# Begin Domain Alliassing
#---------------------------------------------
RewriteEngine On
#---------------------------------------------
# sub.domain.com
RewriteCond %{HTTP_HOST} sub.domain.com$ [NC] 
RewriteCond %{REQUEST_URI} !^/sub/.*$ 
RewriteRule ^(.*)$ /sub/$1
[/SIZE]

the www.sub.domain.com rewrite rule doesn’t have to be added since everyting with ***.sub.domain.com will be redirected to the /html/sub/ map.

Of course this is still a littlebit silly… since it should be in the CP.
I’ll post here if it works…

well treid both… did’t work :frowning:

There is no need for a redirect b/c you are doing it at the apache level.
You can also just add this code into the /etc/httpd/conf.d/domain.com.conf and not make a seperate files (either way on that part). This should work the same for either NameVirtualHost IP or “static”

<VirtualHost 83.149.68.198:80>
SuexecUserGroup domainco domainco
DocumentRoot /home/domainco/domain.com/sub
ServerName sub.domain.com
ServerAlias www.sub.domain.com
ServerAdmin [email]webmaster@domain.com[/email]

ErrorLog /home/domainco/var/domain.com/logs/error.log
CustomLog /home/domainco/var/domain.com/logs/transfer.log combined

php_admin_flag engine On
# cgi: 1 don't edit between this and the "end cgi" comment below
<Directory /home/domainco/domain.com/sub>
AllowOverride AuthConfig FileInfo Options Limit Indexes
Options +ExecCGI
</Directory>
ScriptAlias /cgi-bin/ /home/domainco/domain.com/sub/cgi-bin/
# end cgi
</VirtualHost>

Thanks for the help.
But I can’t get it to work, maybe because it’s late again here in Holland…
I will try again tomorrow or something.

Oh,

Did you remember to “apachectl -k graceful” or “service httpd restart” after making the above changes?

Also make sure you already made the A record for sub pointing to the same IP as the main domain.

Yup on all the nodes + manager.
But it could be becouse of all the beer, that I typed some things double :wink:
Well tomorrow (well today in a few hours) it will be another day.
Yesterday I set up the Secondary non-Iworx DNS server which is working great.
Today I fixed a MySQL issue on the manager.
Maybe tomorrow I find something to fix this.

I also openend a ticket about this, since our customers NEED to have subdomains.

Thanks for the help anyway, it’s apriciated!:smiley:

Well it works, but this is really not a solution. Today I had to make 5 subdomains for 1 user. I’m busy with that for +/- 30 minutes (makeing the config for every subdomain, copying it to the nodesand restarting httpd)

I currently have to switch new customers back to Ensim since they want to make subdomains. So my new servers with Iworx are almost completely useless at the moment.

webXtrA,

per my response to your ticket we’ll get you a patch for the subdomain propagation.

Chris

InterWorx is the greatest! :smiley:

Anybody found a solution to get this working?

Got customers waiting for it for more than 2 months now :frowning:

Guys, I’ll post here my last response from the ticket on the matter:

I tried to explain that what I thought was a fairly easy addition is actually much more intense and that subdomains with the current version and clustering are almost impossible to make work easily.

I do have 1 option that may work.

If you edit each of your vhost files and add a “ServerAlias *.<domain>” entry and then edit the /home/interworx/siteworx/smarty/templates/interworx/menu.tpl file and take out the code that is stopping the subdomain menu from being shown (it’s just an if statement) that should allow subdomains to work (albeit not ideally).

Chris

It’s working :smiley:

Do you know if in v3 version subdomain and pointer domain will be able in a cluster env ?

I have been waiting for 7 months now to migrate to a cluster env. Because I THOUGHT v3 should do things much better for the cluster.

But will it be the case ?

Pascal

Yep, subdomains and pointers will work in v3 with clusters.

Chris