ServerAlias instead of Redirect? and httpd.conf question(s)

young

Verified User
Joined
Oct 22, 2003
Messages
84
edit: instead of using Domain Pointers to Redirect.

where can i get more information about ./directadmin/data/users/admin/httpd.conf ?
how is it generated?
is it regenerated from scratch when i modify a domain?
if i modify the file will the modifications stick after i save settings in directadmin?

is there a way i can add ServerAlias's in directadmin or do i have to use Redirect?
if i had a couple of domains and wanted them to point to one main domain, would it be better to use ServerAlias?

for example:
<VirtualHost x.x.x.x:80>

ServerName www.main.com
ServerAlias www.main.com main.com *alias1.com *alias2.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^main\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.*\.)?alias.\.com$ [NC]
RewriteRule ^(.*)$ http://www.main.com/$1 [R=301,L]

</VirtualHost>


if i decide to just use ServerAlias instead of Redirect's, do i still have to add the domain names in the dns admin and ip manager?
would i have to have to go to "your user -> modify dns record" and manually add:

ftp A x.x.x.x
alias.com. A x.x.x.x
localhost.alias.com. A 127.0.0.1
mail A x.x.x.x
pop A x.x.x.x
www A x.x.x.x
alias.com. NS ns1.xxx.com.
alias.com. NS ns2.xxx.com.
alias.com. MX 0
 
Last edited:
Hello,

Those files are rewritten each time a change is made. You can customize how DirectAdmin does it's virtual hosts 2 ways

1) modify the template
2) use the custom httpd.conf feature


1) the templates are located in /usr/local/directadmin/data/templates/virtual_host*.conf. If you want to make changes, first copy them to the custom folder, then make changes to the copied file (main virtual_host*.conf files will be overwritten during updates. custom virutal_host*.conf files take priority).

For the new templates to take effect, you have to run:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

2) Admin Panel -> Admin Settings -> cutom httpd configuraitions -> domain.com -> add the changes needed. Note that the changes will be inserted into the |CUSTOM| token from the template, so this may or may not work for your needs.

John
 
1) the templates are located in /usr/local/directadmin/data/templates/virtual_host*.conf. If you want to make changes, first copy them to the custom folder, then make changes to the copied file (main virtual_host*.conf files will be overwritten during updates. custom virutal_host*.conf files take priority).


Can't find the word "Redirect" in those files, so which is the template for Domain Pointers creation?

Thanks
Ilan
 
Hello,

Redirects are hard coded.. To create the ServerAlias, you'd just manually get the domain pointing to the correct IP, and then add:

ServerAlias pointer.com www.pointer.com

To the domain.com's custom httpd.conf file using:
Admin Panel -> Admin Settings -> Cusomize httpd.conf -> domain.com
Note that you must use this feature or else any manual changes to the users' httpd.conf will dissapear when changes are made.

I think the ServerAlias method would actually be more efficient. It can be changed.. but we'd just need to make sure that everyone who has ever created a custom/virtual_host*.conf file adds the required tokens to their files.

John
 
The web alias works fine, but now I have two more new questions:

1.- What should I do to configure also those pointers as mail-server aliases?

2.- Do you know if I need to do something "extra" to enable Webalizer to analyze (and maybe differentiate) the traffic received through those aliases?
 
Hello,

1) add the domain into both the /etc/virtual/domains and /etc/virtual/domainowners file. You'll need to also create a symbolic link from /etc/virtual/pointer.com to /etc/virtual/real.com and /var/spool/virtual/pointer.com to /var/spool/virtual/real.com

2) The log files would be the same, so webalizer would be parsing both domains. The logs don't store any domain dependant info, so I don't think it would know any different.

John
 
Back
Top