ispCP - Board - Support
Domain aliases with same mount point - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: Suggestions (/forum-2.html)
+--- Thread: Domain aliases with same mount point (/thread-921.html)

Pages: 1 2


Domain aliases with same mount point - greg - 07-05-2007 02:10 PM

Hi all !
I need something that I can't do with the actual version of ispcp... (nightly 20070627)

Some of my customer's websites have several domain names for the same content. If I add domain aliases, I have the choice between take another document_root or make a redirection. The solution seems to be the second case, because another document_root is not appropriate for a unique website.

But in some case, we don't want a redirection ! We want keeping the url with the domain alias (we can have several reasons for that... web indexing, dynamic content based upon the domain...)

So what I want is the possibility to define a domain alias with a mount point like "/" and also to have several domain aliases with the same mount point !

In order to have this working, I make two little modifications by shortcutting the checks in the web admin :
Code:
file /var/www/ispcp/gui/include/input-checks.php line 409 :
        if (($token) && (!chk_username($token, $num)))

file /var/www/ispcp/gui/reseller/add_alias.php line 203 :
            // whe have alias with same mount point !!! ERROR
            //$err_al = tr("There are alias with same mount point");

It seems to be good for me... but I still have a problem : I think that you must have a good reason to forbidden this configuration ! And I don't find any answer about it.

I only see one bug with this method : when I create a domain on an existing mount point, the document_root seems to be overridden by the default content, and if I delete one of the aliases, the document_root will be erased.

But if this is the only problem, I think that it is not very difficult to check if another alias use the same mount point, and in this case to not overridden/erase the document_root.

Thanks.


RE: Domain aliases with same mount point - ephigenie - 07-05-2007 06:47 PM

please keep in mind - if you set an 2 domains at the same mountpoint they're not aware of each other... So if you delete one ... the complete directory (for both) will be deleted.


RE: Domain aliases with same mount point - raphael - 07-06-2007 02:11 AM

The engine is the one that needs to be tweaked


RE: Domain aliases with same mount point - greg - 07-06-2007 03:18 AM

ephigenie Wrote:please keep in mind - if you set an 2 domains at the same mountpoint they're not aware of each other... So if you delete one ... the complete directory (for both) will be deleted.

Okay but I think we can solve this problem. When a domain is deleted, this is the good moment for doing some checks into the database : if another domain is found with the same mount point, then the directory is not deleted.

note : if this solution is okay, I'm ready to do the work and then send you a patch


RE: Domain aliases with same mount point - greg - 07-06-2007 03:48 AM

raphael Wrote:The engine is the one that needs to be tweaked

Now I think I have to tweak the file /var/www/ispcp/engine/ispcp-dmb-mngr

Into the subfunction dmn_add_httpd_file_data :
- ask the database if another domain already share the same mount point
- in this case, bypass some mkdir to avoid overridden of the content

Into the subfunction dmn_del_httpd_file_data :
- ask the database if another domain also share the same mount point
- in this case, bypass the deletion of the directories

Tell me if I'm wrong
Thanks


RE: Domain aliases with same mount point - raphael - 07-06-2007 04:05 AM

I think it's all right Wink


RE: Domain aliases with same mount point - greg - 07-06-2007 04:22 AM

raphael Wrote:I think it's all right Wink

Good Smile

I see another point about the backup : with a same mount point, I think that the unique web content is backuped several time (one backup for each domain). But it should work... so maybe it's not a big problem.
Do you think we have to tweak the backup system to keep only one backup for the first domain and disabled the others ?

I don't see another problems... Each domains should have their own log files with their own statistics, and this is normal. No common stats are possible with this configuration.

I need you expertize to know if I forget something else...


RE: Domain aliases with same mount point - raphael - 07-06-2007 08:06 AM

There should be no problem if what you are allowing is to add an alias or subdomain on a same mount point. Because the backups engine is ran only once per domain, it doesn't take care of whether subdomains or aliases exist or not.


RE: Domain aliases with same mount point - greg - 07-17-2007 05:17 PM

Here is my patch ! (based upon the nightly build version 20070717)

Some modifications in the web part :
  • I remove the "same mountpoint" check in the reseller GUI
  • I remove the "same mountpoint" check in the client GUI
  • I allow the mountpoint to be only "/" (same as the main domain)

And some others in the engine part :
  • When adding a domain alias, I skip the creation of the web root files if the mount point is already in use
  • When removing a domain alias, I skip the deletion of the web root files if the mount point is shared and still in use

I think it's an usefull modification, and if I forgot nothing, it's not very difficult to integrate...
So I hope this enhancement can be include in the 1.0.0 version Smile

PS: the ticket is here http://www.isp-control.net/ispcp/ticket/483


RE: Domain aliases with same mount point - Zothos - 07-17-2007 06:23 PM

nice greg, thanks for contributing your stuff Wink