NEXUCOM - Support / Knowledge Base

Search:     Advanced search
Browse by category:

How to Using a custom VirtualHost template [DirectAdmin]

Views: 1533
Votes: 1
Posted: 24 Dec, 2007
by: Tech A.
Updated: 25 Dec, 2007
by: Tech A.

If you wish to change the setup of the VirtualHosts for all domains, you can do so by creating your own custom templates.

cd /usr/local/directadmin/data/templates
cp virtual_host*.conf custom
cd custom


Once you've copied the 4 VirtualHost files (or just the ones you want) to the custom directory, you can then edit the new files you've just copied. DirectAdmin will always check for the custom file before going to the default ones. Failure to copy the virtual_host*.conf files to the custom directory before modifying them will result in a loss of all changes when DirectAdmin updates itself (the files are overwritten)

Inside the virtual_host*.conf files, you'll find code that is similar to httpd.conf code, but contains what are known as tokens. These tokens are what will be replaces with specific user data for each domain created.

 

Available tokens

DOMAIN

the name of the domain. eg: domain.com

IP

the IP address associated with that domain. eg: 192.168.3.4

HOME

The users home directory. eg: /home/gary

ADMIN

The email address of the server admin. webmaster@domain.com

HOSTNAME

The hostname of the server. eg: server.domain.com

SAFE_MODE

ON or OFF if php safe_mode is enabled or not

PHP

ON or OFF if php is enabled or not

CGI

The whole httpd.conf line used to add the Script-Alias

HANDLERS

httpd.conf code holding all apache handlers

MIMETYPE

httpd.conf code holding all apache mime types

USER

the username

GROUP

the users group name (99% of the time, it's the same as the USER)

DOCROOT

The DocumentRoot of the VirtualHost. This is the path that apache will use to access the data when the ServerName (domain.com) is requested

SUB

for the virtual_host_*sub.conf file, the subdomain name. eg: sub

CUSTOM

custom httpd.conf code to be inserted if the domain.com.cust_httpd file exists. (See Adding custom httpd.conf code the VirtualHost of one domain)

CAROOT

The whole httpd.conf line used to load in the SSLCACertificateFile directive

CERT

The path of the certificate to be used for the domain

KEY

The path of the certificate to be used for the domain


The top of the templates should contain |?CGI=...| and |?DOCROOT=...|. These lines are where the data for the CGI and DOCROOT tokens are set. If cgi is not enabled, this line wil be ignored and the CGI token will be empty. If the domain is suspended, the DOCROOT will be filled the the path of the suspend page. The CAROOT token will be empty unless the User has added a valid CARootCertificate through DA.

You can use tokens when assigning a value to CGI or DOCROOT, just use `TOKEN` instead of |TOKEN|.

Once you are happy with your new virtual_host*.conf files they'll need to be used in the real httpd.conf files. You can trigger DirectAdmin to rewrite all User httpd.conf files by running:

 

echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue


The command will be added the the task queue which is checked once per minute, so it may be a few minutes before all httpd.conf files have been rewritten. *Note: the main /etc/httpd/conf/httpd.conf is never overwritten (unless DirectAdmin is reinstalled) so any changes you make will be safe.
 

Others in this Category
document How to view Log [DirectAdmin]
document How to Updating Apache to the latest version [DirectAdmin]
document How to Adding custom httpd.conf code to the VirtualHosts of a domain [DirectAdmin]
document CGI files Generate Internal Server Error [DirectAdmin]
document How to Running CGI script from any directory or via /~username/cgi-bin [DirectAdmin]
document How to Using an external Mailserver [DirectAdmin]
document Apache Stops Responding but is Running [DirectAdmin]
document How to use SSH [DirectAdmin]
document How to view Log File Paths [DirectAdmin]
document Partition /var is Full [DirectAdmin]
document How to Change Email Password without logging in [DirectAdmin]
document Error connecting to IMAP server: localhost. 115 : Operation now in progress [DirectAdmin]
document How to Setting up DA with an SSL certificate [DirectAdmin]
document How to Setup the Mail System [DirectAdmin]
document Apache won't start and there is nothing in the logs [DirectAdmin]
document IMAP not working. Can't connect to 143 [DirectAdmin]
document Error to /usr/include/krb5.h:2606:24: et/com_err.h: No such file or directory [DirectAdmin]
document How to Add Reverse IP Lookup on your IP's [DirectAdmin]
document How to Showing files in a directory [DirectAdmin]
document How to Adding Custom Modules to php [DirectAdmin]
document Proftpd won't start [DirectAdmin]
document I do not want to run DNS services on my DirectAdmin Server [DirectAdmin]
document How to Updating and Compiling Apache and PHP [DirectAdmin]
document How to Customize the Output of Webalizer [DirectAdmin]
document How to Updating DirectAdmin Manually [DirectAdmin]
document How to Updating your DirectAdmin License Manually [DirectAdmin]
document Apache won't restart: [crit] (98)Address already in use: make_sock: could not bind to port 8090 [DirectAdmin]
document How to Allow Webalizer Stats to be Viewable through the web [DirectAdmin]
document Hotlink Protection: How to Prevent People from Stealing your Files [DirectAdmin]
document Webmail Quotas don't match actual quotas [DirectAdmin]
document How to Creating a Language Pack for DirectAdmin [DirectAdmin]
document How to Enable SpamAssassin on your Server [DirectAdmin]
document How to Forward a Website to Another URL [DirecAdmin]
document Spamassassin : Can't locate HTML/Parser.pm in @INC [DirectAdmin]
document New user using over 100 meg of space and nothing has been added yet [DirectAdmin]
document Named is not reloading correctly when I add a domain [DirectAdmin]
document Server replied: 421 Unexpected failure, please try later [DirectAdmin]
document Disk Usage is showing 0.00 [DirectAdmin]
document My /etc/virtual/domainowners file is empty. How do I rebuild it? [DirectAdmin]
document How to Optimize MySQL [DirectAdmin]
document Error connecting to MySQL: Access denied for user: 'da_admin@localhost' (Using password: YES) [DirectAdmin]
document How to setup /~username/domain.com [Directadmin]
document I've deleted /home, how do I recreate the directories? [DirectAdmin]
document Make the bandwidth, disk uage and webalizer stats update more often [DirectAdmin]
document Installing DBD::mysql from source [DirectAdmin]
document Adding Custom Modules to Apache [DirectAdmin]
document How to Update your exim.conf [DirectAdmin]
document Setting the System Date and Clock [DirectAdmin]
document How to reset a user on the same day of the month his account was created [DirectAdmin]
document How to Downgrade from Apache 2 back to Apache 1.3 [DirectAdmin]
document Frontpage on FreeBSD 5.x [DirectAdmin]
document Webalizer produces: error while loading shared libraries: libgd.so.2 [DirectAdmin]
document How to Server to Server Transfer of All Accounts [DirectAdmin]
document How to Transfer a Domain from one User to Another [DirectAdmin]
document 550-Verification failed for user@email.com [DirectAdmin]
document Permission Denied: Creating Lock File Hitching Post [DirectAdmin]
document How to Create a Login Page for DirectAdmin on your Website [DirectAdmin]
document Get Exim to Listen on Another Port on Top of Port 25 [DirectAdmin]
document How to Downloading a New Webalizer Binary [DirectAdmin]
document How to Creating your Own Service Monitor [DirectAdmin]
document Connecting to www.directadmin.com[66.51.122.131]:443... failed: Cannot assign requested address [DirectAdmin]
document How to Completely Rebuild your /etc/virtual directory [DirectAdmin]
document Share a domain between 2 users [DirectAdmin]
document /usr/libexec/ld-elf.so.1: Shared object libm.so.2 not found, required by my_print_defaults [DirectAdmin]
document view.c:347: REQUIRE((&view->references)->refs > 0) failed [DirectAdmin]
document What ports do I need to open in my firewall? [DirectAdmin]
document The data in /usr/local/directadmin/data/users is gone. I need to create it again [DirectAdmin]
document Warning: Illegal offset type in /path/to/somefile.php after php upgrade [DirectAdmin]
document Translating hardcoded DirectAdmin results [DirectAdmin]
document I can't login to DirectAdmin on port 2222 [DirectAdmin]
document How to Create an Email Account that Deletes Incoming Mail [DirectAdmin]
document Error with wget: use `--no-check-certificate` for licenses/updates [DirectAdmin]
document How to Add Frame Forwarding to your Website [DirectAdmin]
document www.domain.com doesn't work, but domain.com works fine [DirectAdmin]
document Increase the max upload filesize in apache/php [DirectAdmin]
document How to Limit the Number of Emails Sent by Each User (Prevent Spammer) [DirectAdmin]
document How to Compiling Proftpd [DirectAdmin]
document Synchronization Error [DirectAdmin]
document How to Running DirectAdmin through Apache on port 80 [DirectAdmin]
document How to Updating Mysql on FreeBSD [DirectAdmin]
document Setting up Outlook to send through SMTP on port 587 [DirectAdmin]
document How to Lower your TTL Just Before an IP Change [DirectAdmin]
document When Compiling vm-pop3d: Error: `UINT16_MAX' undeclared (first use in this function) [DirectAdmin]
document Why do I need an owned IP for my own SSL Certificate? [DirectAdmin]
document How to Setup Jailed SSH and Jailed CGI (beta) [DirectAdmin]
document How to Track which Site is using the Apache Processes. [DirectAdmin]
document Setting Up webmail.domain.com as Default for New Domains [DirectAdmin]
document Moving Users between Resellers [DirectAdmin]
document How to Setup vm-pop3d to Run Through xinetd [DirectAdmin]
document Apache won't Start After Update on FreeBSD [DirectAdmin]
document How to Downgrade to MySQL 4.0 from 4.1 (Linux/rpms) [DirectAdmin]
document How the Multi Server DNS Clustering Works [DirectAdmin]
document Mysql rpm install: Error: Failed dependencies: perl(DBI) is needed by MySQL-server-4.0.26-0.i386 [DirectAdmin]
document Error: Cannot Find SSL Binaries Under /usr [DirectAdmin]
document ERROR (2): Header May Not Contain more than a Single Header, New Line Detected. (/webmail/inc/inc.php:169) [DirectAdmin]
document crond[12345]: User account has expired [DirectAdmin]
document Fatal error: Allowed memory size of 123456 bytes exhausted (tried to allocate 234567 bytes) in /path/file.php [DirectAdmin]
document mysql_connect(): Too many connections in /path/to/file.php on line 123 Unable to connect to sql server [DirectAdmin]
document I'm getting the same message downloaded to outlook 2 or 3 times when I use "leave message on server" [DirectAdmin]
document Timestamp of files through ftp are different that actual timestamp [DirectAdmin]
document How to downgrade/upgrade MySQL on FreeBSD [DirectAdmin]
document The task.queue is not being processed [DirectAdmin]
document How to Convert mbox files to Maildir Manually [DirectAdmin]
document semget: No space left on device [DirectAdmin]



RSS

Services d'Hébergement: Hébergement Web | Serveurs Dédiés | Streaming | Colocation Serveurs | Nom de Domaine | Support |

Hosting Services: Web Hosting | Dedicated Servers | Streaming | Servers Colocation | Domain Name | Support |

Services: | Hébergement | Serveurs | Colocation |

Copyright © 2003-2008. NEXUCOM, All Rights Reserved.

Mascot - Mascots - DirectAdmin - big - mf - Boiler Biomass - Mascottes - Mascots - Webmail - gt - Chaudière Biomasse - Mascottes - Mascotte -

statistics