Home
Apache


   Apache have to be configured for name based virtual hosting. At the end of httpd.conf but before the row

include /etc/httpd/conf/include/include


Apache needs these directives:


# Replace 192.168.1.2 with your IP address. Must be the same
# as the value of the $virtual_host_ip variable in conf_inc.php
# Replace wht.org with your system domain.

NameVirtualHost 192.168.1.2

# This should be your system domain virtual area

<VirtualHost 192.168.1.2>

  ServerName wht.org
  ServerAlias www.wht.org
  RLimitCPU 30
  RLimitMem 20000000
  RLimitNProc 20

  DocumentRoot /var/www/html
  Options Includes Indexes FollowSymlinks
  DirectoryIndex index.php index.php3 index.html index.htm

  AddType application/x-httpd-php .php

  ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"


  CustomLog /var/log/httpd/access_log combined
  ErrorLog /var/log/httpd/error_log

</VirtualHost>

# If HTTP 1.0 is used from the clienc or some script
# it will not recognize the virtual hosts. So you have to enable
# PHP in the DocumentRoot directory

<Directory /var/www/html>

AddType application/x-httpd-php .php

</Directory>


 Probably PHP is enabled globally. You have to disable it. WHT will enable PHP inside the virtual hosts' areas. So outside virtual host area must not have:

AddType application/x-httpd-php .php

or

<Files *.php>
  SetOutputFilter PHP
  SetInputFilter PHP
  LimitRequestBody 524288
</Files>

Note: In RedHat 9 the above directives are included as separate file /etc/httpd/conf.d/php.conf. Just disable them.


   To serve the sites Apache needs to be configured every time a user registers or deletes new domain. In fact, WHT configures the web server only once a day. That's because Apache have to be restarted for the changes to take effect. This is done by the script wht_cron.php. The script is run by crond at the time you specified when installing (2 a.m.).wht_cron.php configures BIND  too and makes a few checks: checks for expired domains and users using MySQL, checks for exceeded quota (including the databases' sizes), checks for users that have no domains. The script notifies the admin if there is something wrong.
   Every month another script wht_apache_log.php checks Apache's log files for exceeded traffic and notifies the administrator,  compresses the files and restarts Apache to create new logs.
   Both scripts restart Apache gracefully (# apachectl graceful).

    When a domain is registered the following section is included as a separate file in httpd.conf


<VirtualHost 192.168.1.2>

    ServerName domain1.com
    ServerAlias www.domain1.com
    RLimitCPU    30
    RLimitMem    20000000
    RLimitNProc    20

    DocumentRoot /var/www/home/w/www/domain1.com
    DirectoryIndex index.php index.php3 index.html index.htm

    LogFormat " %b" wht_log
    CustomLog /var/log/wht/bytes/domain1.com wht_log
    CustomLog /var/log/wht/access_domain1.com common
    ErrorLog /var/log/wht/error_domain1.com

</VirtualHost>


If PHP and CGI enabled


<VirtualHost 192.168.1.2>

   ServerName domain1.com
   ServerAlias www.domain1.com
   RLimitCPU    30
   RLimitMem    20000000
   RLimitNProc    20

   DocumentRoot /var/www/home/w/www/domain1.com
   DirectoryIndex index.php index.php3 index.html index.htm

   AddType application/x-httpd-php .php

   ScriptAlias /cgi-bin/ "/var/www/home/w/www/domain1.com_cgi-bin/"

   php_admin_value open_basedir /var/www/home/www/w/domain1.com

   SuexecUserGroup w w

   LogFormat " %b" wht_log
   CustomLog /var/log/wht/bytes/domain1.com wht_log
   CustomLog /var/log/wht/access_domain1.com common
   ErrorLog /var/log/wht/error_domain1.com

</VirtualHost>


For free account if $enable_cgi_free="off" (default)


<VirtualHost 192.168.1.2>

   ServerName domain1.com
   ServerAlias www.domain1.com
   RLimitCPU    30
   RLimitMem    20000000
   RLimitNProc    20

   DocumentRoot /var/www/home/w/www/domain1.com
   DirectoryIndex index.php index.php3 index.html index.htm

   ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

   Action text/html /cgi-bin/wht_handler.cgi

   LogFormat " %b" wht_log
   CustomLog /var/log/wht/bytes/domain1.com wht_log
   CustomLog /var/log/wht/access_domain1.com common
   ErrorLog /var/log/wht/error_domain1.com

</VirtualHost>


For free account if $enable_cgi_free="on" (experimental)


<VirtualHost 192.168.1.2>

   ServerName domain1.com
   ServerAlias www.domain1.com
   RLimitCPU    30
   RLimitMem    20000000
   RLimitNProc    20

   DocumentRoot /var/www/home/w/www/domain1.com
   DirectoryIndex index.php index.php3 index.html index.htm
   ScriptAlias /cgi-bin/ "/var/www/home/w/www/domain1.com_cgi-bin/"

  ExtFilterDefine wht_ext_filter mode=output \
  cmd="/bin/wht_ext_filter /var/www/home/w/domain1.com/some_file.html"

  SetOutputFilter wht_ext_filter

   SuexecUserGroup w w

   LogFormat " %b" wht_log
   CustomLog /var/log/wht/bytes/domain1.com wht_log
   CustomLog /var/log/wht/access_domain1.com common
   ErrorLog /var/log/wht/error_domain1.com

</VirtualHost>



  You can run wht_cron.php more than once a day but I do not recommend.

  If you want to allow your users using .htaccess files include the following directives in httpd.conf:


# /var/www/home is the home directory. Must be the same
# as the value of the $userhomedir variable in conf_inc.php

<Directory /var/www/home>
  AllowOverride FileInfo Indexes AuthConfig Limit
  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>