Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th May 2010, 01:20
apoana apoana is offline
Junior Member
 
Join Date: Feb 2010
Posts: 3
Thanks: 0
Thanked 5 Times in 2 Posts
Default automatic temporary URL for new sites

This is not heavly tested, but, it's an hack to have an temporary URL for a new site/domain.

Please, ready this:

1) Tested on multi domain setup
2) server hosting sites have the name - in this example: isp01-ww1.myhost.com
3) You need to alter the DNS provider for myhost.com
4) Don't blame me for problens
5) All temporary site URL will become yoursite.vsite.isp01-ww1.myhost.com in this example

Let's go:

1) add in you master site (or hosting site) DNS an entry like this:

Code:
*.vsite.isp01-ww1.myhost      Alias (CNAME)     Default       isp01-ww1.myhost.
or

Code:
*.vsite.isp01-ww1.myhost      A     Default       1.2.3.4
2) edit "/usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php" - in the server where the apache server hosting is running

3) Find in the above script:

PHP Code:
// begin a new ServerAlias line after 30 alias domains
foreach($server_alias as $tmp_alias) {
   if(
$n 30 == 0$server_alias_str .= "\n    ServerAlias ";
   
$server_alias_str .= $tmp_alias;


4) Change to:

PHP Code:
foreach($server_alias as $tmp_alias) {
    if(
$n 30 == 0$server_alias_str .= "\n    ServerAlias ";
    
$daliases explode(" "trim($tmp_alias));
    foreach(
$daliases as $dalias) {
        if (
trim($dalias) != "") {
            
$server_alias_str .=  trim($dalias) . " " trim($dalias) . ".vsite." trim($conf['serverconfig']['server']['hostname']) . " ";
       }
    }

5) Save the file

6) Now, every time you add an new site or alias site, ISPCONFIG generate an apache configuration like:

ServerAlias www.newdomain.com www.newdomain.com.vsite.isp01-ww1.myhost.com

and this allow your client to access an new domain/site in ISPCONFIG without need to change the DNS pointing for the new site/domain. This is done using URL www.newdomain.com.vsite.isp01-ww1.myhost.com, as in case of this example.


TODO;

1) Display in cleint area where to access new site using the temporary URL
Reply With Quote
The Following User Says Thank You to apoana For This Useful Post:
falko (15th May 2010)
Sponsored Links
  #2  
Old 9th September 2010, 21:17
radim_h radim_h is offline
Senior Member
 
Join Date: Jan 2007
Location: Prague, Czech
Posts: 420
Thanks: 33
Thanked 24 Times in 19 Posts
Send a message via ICQ to radim_h
Default

Here is modification from my friend QUIP

Replace:
Code:
foreach($server_alias as $tmp_alias) {
   if($n % 30 == 0) $server_alias_str .= "\n    ServerAlias ";
   $server_alias_str .= $tmp_alias;
}
with
Code:
foreach($server_alias as $tmp_alias) {
    if($n % 30 == 0) $server_alias_str .= "\n    ServerAlias ";
    $daliases = explode(" ", trim($tmp_alias));
    foreach($daliases as $dalias) {
        if (trim($dalias) != "") {
            $wild_dalias = preg_replace('/^www\./', '*.', trim($dalias)) . '.' . trim($conf['serverconfig']['server']['hostname']);
            $short_dalias = preg_replace('/^www\./', '', trim($dalias)) . '.' . trim($conf['serverconfig']['server']['hostname']);
            $server_alias_str .=  trim($dalias) . " " . $wild_dalias . " " . $short_dalias . " ";
       }
    }
}
Then every domain will have bit different type of preview:

domain.tld
will have aliases
domain.tld.servername.serverdomain.tld, *domain.tld.servername.serverdomain.tld

but only when in
Web Sites=>Domain =>Auto-Subdomain "www." or "*." is chosen
it will not work with None

Last edited by radim_h; 10th September 2010 at 15:21.
Reply With Quote
  #3  
Old 10th September 2010, 10:46
radim_h radim_h is offline
Senior Member
 
Join Date: Jan 2007
Location: Prague, Czech
Posts: 420
Thanks: 33
Thanked 24 Times in 19 Posts
Send a message via ICQ to radim_h
Default

don't you have any idea how to make that ServerAlias to be in apache config permanently (also with None selected) ?
Reply With Quote
  #4  
Old 10th December 2010, 19:55
omig omig is offline
Junior Member
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default temporary/test URL for any subdomain setting

Here is my solution, it works for any subdomain setting. I suggest adding this feature to svn.

Find in the /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php script:
Code:
>$tpl->setVar('alias','');
>	}
after that, add:
Code:
//* Add "temporary URL" Server alias like exampletld.server.mydomain.com
$vhost_domain = $tpl->getVar('domain');
$new_site_temporary_url = "\n    ServerAlias " . preg_replace("/\./","",$vhost_domain) . '.' . trim($conf['serverconfig']['server']['hostname']);
$server_alias_str = $tpl->getVar("alias") . $new_site_temporary_url;
$tpl->setVar('alias',$server_alias_str);
Reply With Quote
  #5  
Old 24th September 2012, 11:29
felan felan is offline
Junior Member
 
Join Date: Aug 2012
Posts: 21
Thanks: 0
Thanked 10 Times in 5 Posts
Default

Been playing around with this solution but I can't really get it to work, where the solution from Radim_h's friend works fine. I am also wondering if this would be possible to set as a checkbox so we can remove this when not needed anymore?

Quote:
Originally Posted by omig View Post
Here is my solution, it works for any subdomain setting. I suggest adding this feature to svn.

Find in the /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php script:
Code:
>$tpl->setVar('alias','');
>	}
after that, add:
Code:
//* Add "temporary URL" Server alias like exampletld.server.mydomain.com
$vhost_domain = $tpl->getVar('domain');
$new_site_temporary_url = "\n    ServerAlias " . preg_replace("/\./","",$vhost_domain) . '.' . trim($conf['serverconfig']['server']['hostname']);
$server_alias_str = $tpl->getVar("alias") . $new_site_temporary_url;
$tpl->setVar('alias',$server_alias_str);
Reply With Quote
  #6  
Old 24th September 2012, 13:24
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 932
Thanks: 16
Thanked 262 Times in 208 Posts
Default

In current svn (upcoming 3.0.5 release) there is a feature for this.
You can configure a server alias for new vhost in the server config for each server.
It will be under system -> server config -> {choose server} -> tab "web" -> auto alias.
__________________
Marius Cramer

pixcept KG
Reply With Quote
  #7  
Old 24th September 2012, 13:26
felan felan is offline
Junior Member
 
Join Date: Aug 2012
Posts: 21
Thanks: 0
Thanked 10 Times in 5 Posts
Default

Wonderful, thanks
Reply With Quote
  #8  
Old 31st May 2013, 02:02
Outbreaker Outbreaker is offline
Junior Member
 
Join Date: May 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A little bit more infos about this option in ISPConfig 3.0.5 would be nice.
1. What exactly do i need to entry in this field?
2. Is the alias only create for new website or also for the existing ones?
3. If i use the Placeholder [website_domain] or [website_id] will the alias also be update if the website domain name or website id changes?
Reply With Quote
  #9  
Old 31st May 2013, 09:23
felan felan is offline
Junior Member
 
Join Date: Aug 2012
Posts: 21
Thanks: 0
Thanked 10 Times in 5 Posts
Default

Hi Outbreaker.

If you go in to Server -> Server Config -> Your server -> WEB, you can see the URL and edit it in Website auto alias. Personally I've set it to [website_domain].testserver.designfyn.dk. That means the URL will be domain.tdl.testserver.designfyn.dk

Hope it helps
Reply With Quote
  #10  
Old 31st May 2013, 12:59
Outbreaker Outbreaker is offline
Junior Member
 
Join Date: May 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

If i do that, do i have to also add this A record in the "DNS Zone"
Hostname / IP-Address
* / 26.153.48.62
Or should this works without this "DNS Zone" entry?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Hardy chrooted bind9 fails to start Djamu Server Operation 35 21st April 2010 08:28
ISPconfig temporary URL mcrider General 1 30th September 2008 00:00
Can you Setup sites using URL instead of IP Address jflesher General 1 20th September 2007 23:58


All times are GMT +2. The time now is 23:41.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.