Q&A: howto use custom dns and http,

How to use custom dns and http?
I tried but dont know the commands to use.
How should I do it?
can you give me an example?
Tried to publish the fix to roundcube, but did not find out where to do it
on ehcp.net. Can you give me a link?

1- Custom dns means, you add dns records other than standard records added by ehcp.
These are bind- dns configuration entries, so, you must obey to bind configuration syntax.
if you don't write correct custom dns entries, then your bind will not restart, will fail.

Example custom dns entry:(as displayed when you add custom dns)

2- Custom http entries are just like custom dns, as they are apache configuration entries.
in the same way, if you write wrong apache configuration entries, apache will not restart, will be - generally- in previous state of apache. Sometime, apache fails to start and you will not able to access your ehcp gui.
in this case one should follow http://www.ehcp.net/?q=node/174

example custom http entry:
CustomLog /var/logs/apache_my_log combined

note that, custom dns/http is similar with edit dns/http template as described in http://www.ehcp.net/?q=node/552#comment-615

3- to upload your fix, post a forum topic or something like that, below input area, click on file attachements, click browse and append your file/fix to your post.

if you have other questions, let me know.


yes, but I want to redirect only a sub-domain.
Not the entire domain.
Is that possible?

You can do that by html redirection.
put following code into an index.html file, then put index.html file in the subdir or anywhere you want:

<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">


I have this question, too. Because I have a Windows (Exchange) server which shares the same IP, I need requests to that Exchange server to be redirected to the Exchange server.

This has been achieved in the past by setting up the CentOS server to have the following in it's httpd.conf file:

ServerName externalFQDN

# ProxyPass Support for Internal Exchange Server
ProxyPreserveHost On

ProxyPass / https://internalFQDN/
ProxyPassReverse / https://internalFQDN/

#OWA % character in email subject fix
RewriteEngine On
RewriteMap percentsubject int:escape
RewriteCond $1 ^/exchange/.*\%.*$
RewriteRule (/exchange/.*) ${percentsubject:$1} [P]

ProxyPass /exchange https://internalFQDN/exchange
ProxyPassReverse /exchange https://internalFQDN/exchange
ProxyPass /owa https://internalFQDN/owa
ProxyPassReverse /owa https://internalFQDN/owa
ProxyPass /Exchange https://internalFQDN/exchange
ProxyPassReverse /Exchange https://internalFQDN/exchange
ProxyPass /exchweb https://internalFQDN/exchweb
ProxyPassReverse /exchweb https://internalFQDN/exchweb
ProxyPass /public https://internalFQDN/public
ProxyPassReverse /public https://internalFQDN/public
ProxyPass /iisadmpwd https://internalFQDN/iisadmpwd
ProxyPassReverse /iisadmpwd https://internalFQDN/iisadmpwd

ProxyPass /oma https://internalFQDN/oma
ProxyPassReverse /oma https://internalFQDN/oma

#ActiveSync (for WM5+ devices)
ProxyPass /Microsoft-Server-ActiveSync https://internalFQDN/Microsoft-Server-ActiveSync
ProxyPassReverse /Microsoft-Server-ActiveSync https://internalFQDN/Microsoft-Server-ActiveSync

# End of Exchange settings

Is there someplace I can put these line in EHCP? I cannot find the httpd.conf file, so the file structure is a little customised. I realise this is beyond the scope of the EHCP system, but it would help me very much.



Background info:
ehcp does very little customization to apache.
Main config file of apache, which is /etc/apache2/apache2.conf is same.
You may also write anything you want in apache configs in /etc/apache2, although this is not very good in every case.

In ehcp way:(quick answer: most easy is item 2)

You may define any apache related config in these two ways:
1- to change default apache config for all domains in ehcp:
go to ehcp dir in server, /var/www/vhosts/ehcp, edit apachetemplate file with apache config syntax rules,
then, go to ehcp gui, options, click sync domains.
This will activate the config you have made for all domains. Custom domain configs will not be affected by this, which are told in item 2.
Do not remove tags such as {domainname} or similar in apachetemplate file.
This is useful for activating a common code in all domains.
Note that, this is a template, and is used to produce apachehcp.conf file in ehcp dir, by repeating same config for all domains. So, do not put general config here, or any config that "repeat of config " is harmful.
if you write something wrong here, apache simply will not start. you need to fix it manually.

2nd way: changing apache config for individual domains:
choose/select the domain you want to change config,
click on "edit apache/http template" .
Write your config, save.
This way, your domain will have a custom http, and does not use apachetemplate file.
To rollback it and use default apachetemplate file, just delete all contents of "custom apache template", then save.
This will revert it back to use common apachetemplate file

3rd and non-ehcp way:
Suppose that you need a general server config that is to be used in whole apache environment.
Then, just put your config in on of /etc/apache2/*.conf files, or just apache2.conf file

This topic is similar to topic: http://ehcp.net/?q=node/552
custom apache/http and custom dns are very similar in ehcp.
both has a general config (apachetemplate, dnszonetemplate) which is used for all (non-custom edited) domains
both may be edited in per-domain basis using edit custom http or dns template.

See you.

Under the custom section of the DNS, would this work for my domain? I need billing.mydomain.com to point to

* IN A {webip}
billing IN A

EHCP Force Edition