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: // 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: 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
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
don't you have any idea how to make that ServerAlias to be in apache config permanently (also with None selected) ?
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);
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?
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.
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?
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
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?
I've added "[client_username]-[website_id].host.domain.tld" to the settings and saved. I've created a *.host.domain.tld DNS record. Say I have a client username called "test" and a website ID of "6", I should be able to see the website at test-6.host.domain.tld. Is that correct? When I visit that URL, I just get the default apache "It works!" page. What am I missing?
The vhost for host.domain.tld? or the vhost for the client site? Noticed that I don't have a vhost for host.domain.tld so I have changed the config to [client_username]-[website_id].domain.tld, saved and waited 10 minutes. I have taken a look at the domain.ltd.vhost and can't see any reference to "test-6" at all.
Also tried creating a new site at "test.domain.com". Checked and working. Updated settings to "[client_username]-[website_id].test.domain.com" Created a DNS record for *.test.domain.com Visited test-6.test.domain.com. Not working. test.domain.com.vhost Code: #cat test.domain.com.vhost <Directory /var/www/test.domain.com> AllowOverride None Order Deny,Allow Deny from all </Directory> <VirtualHost *:80> DocumentRoot /var/www/test.domain.com/web ServerName test.domain.com ServerAlias domainuser-12.domain.com ServerAlias www.test.domain.com ServerAdmin [email protected] ErrorLog /var/log/ispconfig/httpd/test.domain.com/error.log Alias /error/ "/var/www/test.domain.com/web/error/" ErrorDocument 400 /error/400.html ErrorDocument 401 /error/401.html ErrorDocument 403 /error/403.html ErrorDocument 404 /error/404.html ErrorDocument 405 /error/405.html ErrorDocument 500 /error/500.html ErrorDocument 502 /error/502.html ErrorDocument 503 /error/503.html <IfModule mod_ssl.c> </IfModule> <Directory /var/www/test.domain.com/web> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory /var/www/clients/client1/web12/web> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> # suexec enabled <IfModule mod_suexec.c> SuexecUserGroup web12 client1 </IfModule> # Clear PHP settings of this website <FilesMatch "\.ph(p3?|tml)$"> SetHandler None </FilesMatch> # php as fast-cgi enabled # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html <IfModule mod_fcgid.c> IdleTimeout 300 ProcessLifeTime 3600 # MaxProcessCount 1000 DefaultMinClassProcessCount 0 DefaultMaxClassProcessCount 100 IPCConnectTimeout 3 IPCCommTimeout 360 BusyTimeout 300 </IfModule> <Directory /var/www/test.domain.com/web> AddHandler fcgid-script .php .php3 .php4 .php5 FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php Options +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> <Directory /var/www/clients/client1/web12/web> AddHandler fcgid-script .php .php3 .php4 .php5 FCGIWrapper /var/www/php-fcgi-scripts/web12/.php-fcgi-starter .php Options +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> # add support for apache mpm_itk <IfModule mpm_itk_module> AssignUserId web12 client1 </IfModule> <IfModule mod_dav_fs.c> # Do not execute PHP files in webdav directory <Directory /var/www/clients/client1/web12/webdav> <ifModule mod_security2.c> SecRuleRemoveById 960015 SecRuleRemoveById 960032 </ifModule> <FilesMatch "\.ph(p3?|tml)$"> SetHandler None </FilesMatch> </Directory> DavLockDB /var/www/clients/client1/web12/tmp/DavLock # DO NOT REMOVE THE COMMENTS! # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE! # WEBDAV BEGIN # WEBDAV END </IfModule> </VirtualHost>
Ok, so if the clients site is called clientsite.com it should be in the clientsite.com.vhost file... Code: #cat clientsite.com.vhost <Directory /var/www/clientsite.com> AllowOverride None Order Deny,Allow Deny from all </Directory> <VirtualHost *:80> DocumentRoot /var/www/clientsite.com/web ServerName clientsite.com ServerAlias www.clientsite.com ServerAdmin [email protected] ErrorLog /var/log/ispconfig/httpd/clientsite.com/error.log <IfModule mod_ssl.c> </IfModule> <Directory /var/www/clientsite.com/web> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> <Directory /var/www/clients/client7/web6/web> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> # suexec enabled <IfModule mod_suexec.c> SuexecUserGroup web6 client7 </IfModule> # Clear PHP settings of this website <FilesMatch "\.ph(p3?|tml)$"> SetHandler None </FilesMatch> # php as fast-cgi enabled # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html <IfModule mod_fcgid.c> IdleTimeout 300 ProcessLifeTime 3600 # MaxProcessCount 1000 DefaultMinClassProcessCount 0 DefaultMaxClassProcessCount 100 IPCConnectTimeout 3 IPCCommTimeout 360 BusyTimeout 300 </IfModule> <Directory /var/www/clientsite.com/web> AddHandler fcgid-script .php .php3 .php4 .php5 FCGIWrapper /var/www/php-fcgi-scripts/web6/.php-fcgi-starter .php Options +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> <Directory /var/www/clients/client7/web6/web> AddHandler fcgid-script .php .php3 .php4 .php5 FCGIWrapper /var/www/php-fcgi-scripts/web6/.php-fcgi-starter .php Options +ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> # add support for apache mpm_itk <IfModule mpm_itk_module> AssignUserId web6 client7 </IfModule> <IfModule mod_dav_fs.c> # Do not execute PHP files in webdav directory <Directory /var/www/clients/client7/web6/webdav> <ifModule mod_security2.c> SecRuleRemoveById 960015 SecRuleRemoveById 960032 </ifModule> <FilesMatch "\.ph(p3?|tml)$"> SetHandler None </FilesMatch> </Directory> DavLockDB /var/www/clients/client7/web6/tmp/DavLock # DO NOT REMOVE THE COMMENTS! # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE! # WEBDAV BEGIN # WEBDAV END </IfModule> </VirtualHost>
Odd that it seems to work for test.domain.com but not for any of the other client sites. Oh, do I need to rebuild the client sites once I have enable this feature?
Ok, put this one down to Stupid User Syndrome (as most of my problems are!). I went into an existing site, changed the Auto-Subdomain to None, saved, changed the Auto-Subdomain back to www, saved and now there is a test-6.test.domain.com alias in the vhost. I guess doing that regenerated the vhost file?
Hii... i dont know how relevant it is now, but i recently installed ISPConfig 3.1.4 on Debian and started using. Shifted many clients and wanted to test before names propagate. So visited this page and tried various things.. I have noticed that while creating website, in ipv4-address, you have minimum 2 options : * and your default IP. If you select * (which generally one selects for future compatibility or whatever) then your "100-yourdom.tld.vhost" file inside /etc/apache2/sites-available gets created with line "<VirtualHost *:80>" ... and in this case ServerAlias does not work, whatsoever.. if u change "<VirtualHost yourip:80>", and restart apache viola! Is it expected or some bug? I wasted 3-4hours just reading and trying, hope this might help someone..