subdomain with alternate doc root

R0yk3

Verified User
Joined
Jul 22, 2010
Messages
8
I used this in Httpd.conf Customization:
|*if SUB="m"|
|?DOCROOT= |?DOCROOT= /home/ccjb/domains/ccjb.nl/public_html||
|*endif|

But it keeps on pointing to
/home/ccjb/domains/ccjb.nl/public_html/m

I only want to change it for 1 domain, so i would not prefer to edit the templates.

kind regards
Roy
 
Indeed a mistype,

i did like the thread said, but stil no effect.
virtual_host_sub.conf is like this

|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html|
|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/var/tmp:/usr/local/lib/php/|
<VirtualHost |IP|:80 |MULTI_IP|>
|CUSTOM|
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/`SUB`/cgi-bin/|
ServerName www.|SUB|.|DOMAIN|
ServerAlias www.|SUB|.|DOMAIN| |SUB|.|DOMAIN| |SERVER_ALIASES|
ServerAdmin |ADMIN|
DocumentRoot |DOCROOT|/|SUB|
|CGI|

|USECANONICALNAME|

User |USER|
Group |GROUP|
CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.bytes bytes
CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.log combined
ErrorLog /var/log/httpd/domains/|DOMAIN|.|SUB|.error.log
<Directory |DOCROOT|/|SUB|>
Options +Includes -Indexes
|*if CLI="1"|
php_admin_flag engine |PHP|
<IfModule !mod_php6.c>
php_admin_flag safe_mode |SAFE_MODE|
</IfModule>
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f |USER|@|DOMAIN|'
|*endif|
|*if OPEN_BASEDIR="ON"|
php_admin_value open_basedir |OPEN_BASEDIR_PATH|
|*endif|
|*if SUPHP="1"|
suPHP_Engine |PHP|
suPHP_UserGroup |USER| |GROUP|
|*endif|
</Directory>
|HANDLERS|
|MIMETYPES|

</VirtualHost>

virtual_host2_sub.conf is like this:

|?DOCROOT=`HOME`/domains/`DOMAIN`/public_html/'SUB'|
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/cgi-bin/|
|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/var/tmp:/usr/local/lib/php/|
<VirtualHost |IP|:80 |MULTI_IP|>
|CUSTOM|
|?CGI=ScriptAlias /cgi-bin/ `DOCROOT`/`SUB`/cgi-bin/|
ServerName www.|SUB|.|DOMAIN|
ServerAlias www.|SUB|.|DOMAIN| |SUB|.|DOMAIN| |SERVER_ALIASES|
ServerAdmin |ADMIN|
DocumentRoot |DOCROOT|/|SUB|
|CGI|

|USECANONICALNAME|

SuexecUserGroup |USER| |GROUP|
CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.bytes bytes
CustomLog /var/log/httpd/domains/|DOMAIN|.|SUB|.log combined
ErrorLog /var/log/httpd/domains/|DOMAIN|.|SUB|.error.log
<Directory |DOCROOT|>
Options +Includes -Indexes
|*if CLI="1"|
php_admin_flag engine |PHP|
<IfModule !mod_php6.c>
php_admin_flag safe_mode |SAFE_MODE|
</IfModule>
php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f |USER|@|DOMAIN|'
|*endif|
|*if OPEN_BASEDIR="ON"|
php_admin_value open_basedir |OPEN_BASEDIR_PATH|
|*endif|
|*if SUPHP="1"|
suPHP_Engine |PHP|
suPHP_UserGroup |USER| |GROUP|
|*endif|
</Directory>
|HANDLERS|
|MIMETYPES|

</VirtualHost>
 
Hi,

my httpd conf form location:
/etc/httpd/httpd.conf

#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.

ServerRoot "/etc/httpd"
Listen 80

#LoadModule dummy_module /usr/lib/apache/mod_dummy.so
Include /etc/httpd/conf/extra/httpd-phpmodules.conf

User apache
Group apache

ServerAdmin [email protected]
DocumentRoot "/var/www/html"

<Directory /home/*>
AllowOverride All
Options -MultiViews -Indexes FollowSymlinks IncludesNoExec +Includes
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

<Directory />
Options All
AllowOverride All
</Directory>

<Directory "/var/www/html">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_suphp.c>
suPHP_Engine On
#suPHP_UserGroup webapps webapps
SetEnv PHP_INI_SCAN_DIR
</IfModule>
</Directory>

<IfModule dir_module>
DirectoryIndex index.html index.htm index.shtml index.php index.php5 index.php4 index.php3 index.phtml index.cgi
</IfModule>

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>

ErrorLog /var/log/httpd/error_log
LogLevel warn

<IfModule log_config_module>
#replace %b with %O for more accurate logging
<IfModule mod_logio.c>
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%O %I" bytes

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>

CustomLog /var/log/httpd/access_log common
</IfModule>

<IfModule alias_module>
# Include some DirectAdmin alias
Include conf/extra/httpd-alias.conf
</IfModule>

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-gzip .tgz
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi
AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AddType video/x-ms-asf .avi
AddType video/mpeg .mpg
AddType video/mpeg .mpeg
AddType video/quicktime .mov
AddType video/x-ms-wmv .wmv
</IfModule>

#EnableMMAP off
#EnableSendfile off

#######################################################################################
# Do not change anything in included files, because they are rewritten by DirectAdmin #
#######################################################################################

# This is needed for PHP
Include conf/extra/httpd-php-handlers.conf

# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf

# Multi-language error messages
Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
Include conf/extra/httpd-autoindex.conf

# Language settings
Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
Include conf/extra/httpd-dav.conf

# Various default settings
Include conf/extra/httpd-default.conf

# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

# Deflate module settings
Include conf/extra/httpd-deflate.conf

# All the DirectAdmin vhosts
Include conf/extra/directadmin-vhosts.conf

# All suPHP directives
Include conf/extra/httpd-suphp.conf

# For user configurations not maintained by DirectAdmin. Empty by default.
Include conf/extra/httpd-includes.conf

#######################################################################################
# End of included files that are rewritten by DirectAdmin #
#######################################################################################

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
 
I hardcoded it in the httpd.conf from the domain.

Why is this not standard in DA?
in other control panels i used this was configurable in the control panel?

Stil thanks.
 
Why is this not standard in DA?

What exactly?

p.s. When I asked you about httpd.conf for the vhost, I wanted to see httpd.conf for certain domain (i.e. virtual host), not your global httpd.conf.
 
Standard in DA? The ability to choose the root dir. in stead of or changing the httpd.conf. one way or another, it is always an admin festure, not for the standard user.

And like you asked, i'll post my httpd.conf for the subdomain:
# Auto generated apache config file by DirectAdmin version 1.38.4
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to his/her website

# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=2
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3

# Frontpage requires these parameters in every httpd.conf file or else
# it won't work.
ServerRoot /etc/httpd

<VirtualHost 178.21.112.35:80>


ServerName www.ccjb.nl
ServerAlias www.ccjb.nl ccjb.nl ccjeroenbosch.nl www.ccjeroenbosch.nl
ServerAdmin [email protected]
DocumentRoot /home/ccjb/domains/ccjb.nl/public_html


UseCanonicalName OFF

SuexecUserGroup ccjb ccjb
CustomLog /var/log/httpd/domains/ccjb.nl.bytes bytes
CustomLog /var/log/httpd/domains/ccjb.nl.log combined
ErrorLog /var/log/httpd/domains/ccjb.nl.error.log

<Directory /home/ccjb/domains/ccjb.nl/public_html>
Options +Includes -Indexes

suPHP_Engine ON
#suPHP_UserGroup ccjb ccjb

</Directory>



</VirtualHost>



<VirtualHost 178.21.112.35:80>

ServerName www.m.ccjb.nl
ServerAlias www.m.ccjb.nl m.ccjb.nl m.ccjeroenbosch.nl www.m.ccjeroenbosch.nl
ServerAdmin [email protected]
DocumentRoot /home/ccjb/domains/ccjb.nl/public_html/m
I got rid of the bold part

UseCanonicalName OFF

SuexecUserGroup ccjb ccjb
CustomLog /var/log/httpd/domains/ccjb.nl.m.bytes bytes
CustomLog /var/log/httpd/domains/ccjb.nl.m.log combined
ErrorLog /var/log/httpd/domains/ccjb.nl.m.error.log
<Directory /home/ccjb/domains/ccjb.nl/public_html>
Options +Includes -Indexes



suPHP_Engine ON
#suPHP_UserGroup ccjb ccjb

</Directory>



</VirtualHost>
 
Well, it works for now. but it is a workaround, not a solution.
Like it says at the top of the haatpd.conf, do not change anything here, because it wil be overwritten .

So if you know a solid solution, please.

Kind regards
Roy
 
Well, it works for now. but it is a workaround, not a solution. Like it says at the top of the haatpd.conf, do not change anything here, because it wil be overwritten. So if you know a solid solution, please.
Unless I'm missing something, DA designed httpd-includes.conf for that purpose. It's included after the last dog is hung and they don't overwrite it. I use that file to document and put all of my turning and other config changes in. I have multiple copies designated by different extensions that I copy to the active for testing and tuning. I leave every other Apache config bone stock.
 
Last edited:
Back
Top