Tag: DirectAdmin
Updating Apache to the latest version
by admin on Jan.27, 2012, under DirectAdmin
You can check the current version of apache by running
httpd -v
If you wish to update your 1.3 version of apache to the most recent, run the following:
cd /usr/local/directadmin/customapache
./build clean
./build update
./build apache_mod_ssl
If you’re using apache 2.x, use "./build apache_2" instead of apache_mod_ssl.
This should update both the configure options and the version of apache to the most recent version. Once the update has completed, you’ll need to restart apache:
RedHat:
/sbin/service httpd restart
FreeBSD:
/usr/local/etc/rc.d/httpd restart
How to add all of the Include lines into your httpd.conf
by admin on Jan.26, 2012, under DirectAdmin
If you reinstall DA (./directadmin i) on a live box, your /etc/httpd/conf/httpd.conf file will get overwritten and emptied of all data. You’ll need to read all of the Include lines for your users so that their sites show up (you’ll be seeing the apache pages, or the shared IP pages instead)
Type:
cd /usr/local/directadmin/data/users
for i in `ls`; do { echo "Include /usr/local/directadmin/data/users/$i/httpd.conf" >> /etc/httpd/conf/httpd.conf; }; done;
Note that this add the include lines for *all* users.. so if you’ve added users to DA after you ran the "./directadmin i", you’ll end up with duplicates. Make sure you don’t have duplicate Include lines.. (apache won’t restart, it will let you know)
How to setup the Mail System
by admin on Jan.25, 2012, under DirectAdmin
One common problem people have is an incorrectly setup mail system. Here is a list of rules that must be followed:
1) hostname must not match any domain that is being used on the system. Example, if you have a domain called domain.com and you want to recieve mail on user@domain.com, you must *not* set your hostname to domain.com. We recommend using server.domain.com instead. You must make sure that you add the A record for server.domain.com so that it resolves.
2) The hostname must be in the /etc/virtual/domains file.
3) The hostname must *not* be in the /etc/virtual/domainowners file.
4) The hostname must resolve. If not, add the required A records to the dns zone such that it does.
5) The directory /etc/virtual/hostname must exist.. (eg: /etc/virtual/server.domain.com). It must not contain any files.
6) Any domains that you want to use for email (eg: domain.com) must be in both the /etc/virtual/domains file and the /etc/virtual/domainowners file. The directory /etc/virtual/domain.com must exist and the files /etc/virtual/domain.com/passwd and /etc/virtual/domain.com/aliases exist.
7) File permissions for virtual pop inboxes should be (not applicable with Dovecot/Maildir):
/var/spool/virtual/domain.com 770 username:mail
/var/spool/virtual/domain.com/* 660 username:mail
If you’ve made any changes to you /etc/exim.conf file and require a fresh copy, you can retrieve one with this guide:
http://help.directadmin.com/item.php?id=51
Ensure your hostname does not contain any upper case letters.
9) Make sure that your main server IP has a reverse lookup on it.
How do I change the DocumentRoot of only one of my subdomains?
by admin on Jan.23, 2012, under DirectAdmin
1) If you wish to change just 1 subdomain path, you’d use this guide as a starting point:
http://help.directadmin.com/item.php?id=3
and insert the following code
|*if SUB="subname"|
|?DOCROOT=/the/new/path/you/want|
|*endif|
This will do a check on the subdomain name.
Change subname to the name of the subdomain you want to set the path for.
Also change the path to the path you’d like.
Failing to use the if statement on the subdomain will cause the main domain and all subdomains to use this new path, which isn’t always as desired.
2) Going into more detail, the DocumentRoot for a subdomain will always have the "sub" name appended to the end. If this is not the desired effect, then the templates would have to be modified to get rid of the bit on the end, while still allowing subdomain paths for normal subdomains to be valid. To do that, first copy the templates to the custom folder
cd /usr/local/directadmin/data/templates/custom
cp ../virtual_host2*_sub.conf
Then edit both of the virtual_host2_sub.conf and virtual_host2_secure_sub.conf files. Find the following line:
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html|
and change it to be:
|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html/`SUB`|
Same thing for this line:
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/`SUB`/cgi-bin/|
change it to be:
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/cgi-bin/|
and one last time for a 3rd line, change:
<Directory |DOCROOT|/|SUB|>
to be:
<Directory |DOCROOT|>
Save the 2 virtual_host2*_sub.conf with these 3 changes, then proceed with step 1 normally, and the path will be what you’re looking for. All existing subdomains will also remain unaffected, since we just moved the SUB part from the bottom, and moved it to the top.
3)Similarly, if you only which to change the path of the domain and not any subdomains, you can use
|*if !SUB|
|?DOCROOT=/the/new/path/you/want|
|*endif|
so that only if there is no subdomain name, then the path will be altered.
How to setup per-domain Aliases
by admin on Jan.22, 2012, under DirectAdmin
If you want to disable /webmail for just one domain (for example), one way to do that is to change the Aliases to be within the VirtualHosts instead of 1 global Alias.
To do that, we’ll need to use the virtual_host2.conf template (for apache 2) and use the custom httpd config settings, found in the Admin Level. This guide assumes you’re using apache 2 with custombuild.
1) Setup the custom template so it’s safe from DA updates:
cd /usr/local/directadmin/data/templates/custom
cp ../virtual_host2.conf .
2) Edit the copied virtual_host2.conf file, and insert the following at the top of the file:
|?WEBMAIL=ON|
Then just below the token that says |CUSTOM| (in the same file) add:
|*if WEBMAIL="ON"|
Alias /webmail /var/www/html/webmail/
|*endif|
3) Go to:
Admin Level -> Custom httpd config -> domain.com
In the textarea at the top, insert this one line:
|?WEBMAIL=OFF|
which will shut off webmail for just that one domain.
4) Remove the global Alias from the /etc/httpd/conf/extra/httpd-aliases.conf file.
5) Issue a full user httpd.conf rewrite, then restart apache.
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d
/etc/init.d/httpd restart
