HSphere Web Server Configuration

This document covers the following issues:

  • Installed Software
  • Apache Web Server Configuration
    • FrontPage Extensions
    • Webshell
    • PHPMyAdmin
    • Third-Party Web Analyzers
      • Webalizer
      • Modlogan
      • AWStats
      • Urchin
    • Web Traffic Calculation
    • Sharing Common Resources with Mail Server Installed on the Same Physical Server
    • Script Restarting Apache
    • Apache suexec
    • List of Packages Compiled with Apache
    • SSL Mode
      • Dedicated SSL
      • Shared SSL
  • FTP Server Configuration
    • User FTP
    • User FTP Traffic Calculation
    • Virtual (Anonymous) FTP
      • Virtual FTP Traffic Calculation
 

Installed Software

  • Web server: Apache
  • FTP server: ProFTPD

    Additional software:

  • SSL support: OpenSSL
  • FrontPage Extensions
  • Third-party statistics packages (log analyzers):
    - Modlogan
    - Webalizer
    - Urchin v.3.xx, 4.xx, 5.xx (supported but not included to the installation)
  • PHP 4.x.x / 5.x.x
  • Perl
  • PHPMyAdmin - PHP-based MySQL administration package
  • Webshell - H-Sphere integrated Web directory browser
  • MnoGoSearch - a search engine
  • sudo - an internal Linux utility that enables to execute a command as another user. All scripts triggered by H-Sphere are executed via sudo

See H-Sphere package list to check the versions of Web server software products included into your H-Sphere installation.

 

Apache Web Server Configuration

Apache configuration directory is /hsphere/local/config/httpd. Also, a symlink alias to this directory is generated in the Apache home directory, that is, /hsphere/shared/apache/conf.

/hsphere/local/config/httpd/httpd.conf - Apache configuration file.

In the Apache config directory, virtual host configuration files are located in the /hsphere/local/config/httpd/sites directory:

  • {domain_id}.conf contains virtual host configuration settings for users' domains.
  • index.conf contains instructions to include {domain_id}.conf files.

(HS 2.5+) /hsphere/local/config/httpd/logrotate.cfg - log rotate config file which includes all log confs located in the /hsphere/local/config/httpd/logrotate_conf/ directory:

  • {domain.name}.transferlog.conf - config file for transfer log rotation for a domain;
  • {domain.name}.errorlog.conf - config file for error log rotation for a domain;
  • {domain.name}.agentlog.conf - config file for agent log rotation for a domain;
  • {domain.name}.referrerlog.conf - config file for referrer log rotation for a domain;
 

FrontPage Extensions

FrontPage Extensions version 5.0, is used as an upload server for Microsoft FrontPage site builder.

/hsphere/shared/frontpage/ is the H-Sphere Frontpage binaries directory.

/hsphere/shared/frontpage/version{number} is a subdirectory where Frontpage distribution is contained.

Also, a symlink to this directory is /usr/local/frontpage/version5.0. This is made for the compliance with default FrontPage settings - FrontPage directory is /usr/local/frontpage by default.

WebShell4

Webshell is the H-Sphere web-based file manager that enables to browse remote directories without knowing the Unix file structure.

/hsphere/shared/apache/htdocs/webshell3 - Webshell 3 installation directory. 

PHPMyAdmin

PHPMyAdmin is a PHP-based MySQL administration package. Its files are located in the /hsphere/shared/apache/php/phpMyAdmin directory.

Webalizer

Webalizer is one of the most popular traffic log analyzers. It is included to default H-Sphere installation and available for Linux-hosted accounts. Webalizer analyzes transfer log and generates readable HTTP transfer reports for a domain.

To activate the Webalizer resource, the Transfer Log resource must be enabled.

Webalizer is installed to /hsphere/shared/bin/webalizer.

/hsphere/shared/apache/conf/webalizer_user.cfg - webalizer config file.

In H-Sphere scripts directory, the following scripts are used for Webalizer activation and update:

- /hsphere/shared/scripts/webalizer-start - script for starting Webalizer
- /hsphere/shared/scripts/webalizer-stop - stop Webalizer
- /hsphere/shared/scripts/webalizer-update.pl - Perl script for Webalizer update

Webalizer directory for a domain: /hsphere/local/home/{user}/{domain.name}/webalizer/.
Webalizer statistics for a domain can be viewed at http://{domain.name}/webalizer/

For the location of user log files, please refer to Third-Party Traffic Calculation.

 

Modlogan

ModLogAn is a third-party traffic calculation utility, similar to Webalizer.

To activate the Modlogan resource, Transfer Log must be enabled.

Modlogan is installed in /hsphere/shared/bin/modlogan.

/hsphere/shared/apache/conf/modlogan_user.cfg - Modlogan config file.

In H-Sphere scripts directory, the following scripts are used for Modlogan activation and update:

- /hsphere/shared/scripts/modlogan-init - script for Modlogan initialization.
- /hsphere/shared/scripts/modlogan-stop - stop Modlogan
- /hsphere/shared/scripts/modlogan-update.pl - Perl script for Modlogan update

Modlogan directory for a domain: /hsphere/local/home/{user}/{domain.name}/modlogan/.
Modlogan statistics for a domain can be viewed at http://{domain.name}/modlogan/

For the location of user log files, please refer to Third-Party Traffic Calculation.

 

AWStats

(v.2.4 and up)

AWStats is a free tool that generates advanced graphical web server statistics reports. AWStats is set up on each Unix/Linux and Windows web server with H-Sphere installation or upgrade. Statistics is calculated for each domain separately.

AWStats directory: /hsphere/shared/awstats.

Each domain has its own AWStats configuration file: /hsphere/local/home/{user}/{domain.name}/cgi-bin/awstats.{domain.name}.conf

AWStats statistics for a domain is available at http://{domain.name}/cgi-bin/awstats.pl

AWStats log directory for a domain: /hsphere/local/home/{user}/{domain.name}/awstats/data/

For the location of user log files, please refer to Third-Party Traffic Calculation.

 

Urchin

Urchin is a third party Web analytics software integrated into H-Sphere. Urchin is installed and configured separately.

Urchin directory: /hsphere/local/urchin.

Urchin collects statistics for each domain into the /hsphere/local/urchin/var/logs/urchin-{domain_id}.log files. This statistics is transfered to the Urchin remote server via HTTP by means of the print-log.pl script located in cgi-bin directory of each domain directory.

Log file with Urchin history: /hsphere/local/urchin/data/history

 

Web Traffic Calculation in H-Sphere

There are two types of traffic calculation in H-Sphere:

  • third-party traffic calculation - H-Sphere writes traffic log files to each domain's directory to make them available for third-party log analyzers: Webalizer, Modlogan, and AWStats
  • H-Sphere built-in traffic calculation - H-Sphere provides its own mechanism of traffic calculation used in billing.

Please refer to a separate document on Web traffic calculation and log rotation in H-Sphere for version 2.5 and up and for versions before 2.5.

 

Sharing Common Resources With Mail Server Installed On The Same Physical Server

If Unix Web server and mail server are installed on one box, one single Apache server is used for both services. Otherwise, Apache web server for mail server running on a separate machine would be simplified, void of Web features such as Frontpage extensions, SSL support, Webshell, Modlogan, Webalizer, rotatelogs and the like.

 

Script Restarting Apache

The following script is used to restart Apache:
/hsphere/shared/scripts/apache-reconfig

Running the script can give large number of warnings. Most of them mean that a user created subdomain(s) through the control panel and then manually deleted the related directory without removing the related configuation. This will not prevent apache from starting or from normal operation.

 

Apache SuExec

H-Sphere web box apache suexec is configured to run users' CGI scripts only within the /hsphere/local/home/ directory, recursively. Thus, a user may run his/her own cgi scripts only if he/she has fourth nesting level within the H-Sphere user home directory, for example, /hsphere/local/home/user_home1.

List of Packages Compiled With Apache

To get the list of packages configured with the Apache server, type the following command under root:

# grep Apache /hsphere/local/var/httpd/logs/error_log

You may get the following packages configuration:

[notice] Apache/1.3.34 (Unix) mod_ssl/2.8.11 OpenSSL/0.9.6b FrontPage/5.0.2.2510 PHP/4.4.4 mod_throttle/3.1.2 configured

 

SSL Mode

SSL is implemented by the mod_ssl utility. There are dedicated SSL mode and shared SSL mode. In the first case, a single SSL certificate is issued for a dedicated IP, in the second case, one SSL certificate would be used for all IPs under the same domain zone.

Dedicated SSL

For dedicated IPs, SSL keys are located in the user home directory:

/hsphere/local/home/{user_name}/ssl.conf/{domain_name}/

If SSL is enabled, the following files will be placed to this directory:

  • server.crt - SSL certificate
  • server.key - SSL private key

Shared SSL

Directories with SSL certificates and keys are located in the Apache config directory (/hsphere/shared/apache/config/).

/hsphere/shared/apache/conf/ssl.shared - directory for shared SSL certificates and keys.

Shared SSL directory structure:

  • ssl.shared/{domain_name} - directory with SSL certificate and private key for a domain

With SSL enabled, the following files are placed into this directory:

  • server.crt - SSL Certificate
  • server.key - SSL Private Key
  • server.csr - SSL signing request (if certificate has been generated by H-Sphere SSL generator tool)

When the user turns off SSL, the files remain on the server. When the user turns SSL back on, they are overwritten with the new files.

 

FTP Server

H-Sphere FTP server is based on ProFTPd version 1.2.4.

ProFTPd binary is /hsphere/shared/sbin/proftpd

There are two kinds of FTP:

  • User FTP: When a new user account is created, its user is provided with the FTP account and thus may download/upload files from/to the user's home directory (/hsphere/local/home/{user_name}) by FTP using his name and password.

  • Virtual (anonymous) FTP: a service provided only for dedicated IP accounts, enables to create virtual accounts to download/upload files from/to virtual account directories that are located within the account home directory, and provides anonymous access to the public directory.
 

User FTP

Log File

/hsphere/local/var/proftpd/logs/xferlog is the FTP log file. When a user uploads or downloads data, the corresponding record is made in the log file.

Configuration

FTP configuration directory is /hsphere/shared/config/ftpd.

/hsphere/shared/config/ftpd/proftpd.conf - FTP configuration file.

/hsphere/shared/config/ftpd/proftpd.conf.shared - FTP subaccounts configuration file.

Download/Upload Permissions

User can download and upload files from his document root directory (/hsphere/local/home/{user_name}/{domain_name}) after he logs in by FTP entering his login name ({user_name}) and password:
ftp user_name@domain_name

User FTP Traffic Calculation

Cron runs the /hsphere/shared/scripts/cron/ftp_anlz_user.pl script on everyday basis for collecting user FTP traffic.

ftp_anlz_user.pl parses the /hsphere/local/var/proftpd/xferlog FTP log file and writes FTP traffic statistics into the /hsphere/local/var/statistic/dd.mm.YYYY.gst.txt statistics files.

The TrafficLoader Java class utility is launched by cron to process FTP traffic statistics and load it to the system database. TrafficLoader also calls the /hsphere/shared/scripts/xfer_cat.pl to gzip outdated statistics files and move them into the loaded directory where they are stored as dd.mm.YYYY.gst.txt.gz archives.

 

Virtual FTP

Log File

For each virtual account, its own configuration file is located in the /hsphere/local/var/proftpd/logs/ directory. File format: {vhost_id}.ftp.log.

For example, wwwuser has virtual FTP enabled for the test.psoft virtual host, and vhost_id=1208 is the virtual host identifier. When the virtual FTP user test3 connects by FTP to the virtual host (ftp This e-mail address is being protected from spam bots, you need JavaScript enabled to view it ), he would be allowed to download and upload (if permissions to write are set to that virtual host) from /hsphere/local/home/wwwuser/1208 directory for downloads and /hsphere/local/home/wwwuser/1208/incoming directory for uploaded files. The log records would be added to /hsphere/local/var/proftpd/logs/1208.ftp.log

The same is true for anonymous FTP account. If this option is enabled for the test.psoft virtual host, any user may connect by FTP using anonymous login and any email as a password, and all his downloads would go to /hsphere/local/home/wwwuser/1208 directory, uploads to the /hsphere/local/home/wwwuser/1208/incoming subdirectory.

Configuration

Configuration directory is /hsphere/local/config/ftpd.

The sites subdirectory contains configuration files {vhost_id}.conf. These files are generat ed by H-Sphere when the new virtual FTP server is created, by parsing the /hsphere/local/home/cpanel/shiva/shiva-templates/common/ftp/ftp.config template where the structure of virtual host configuration is set.

The sites/index.conf file contains the inclusions of the {vhost_id}.conf files.

The sites/{vhost_id}.passwd files contain information on the following accounts:

- {web_user_name} - name of the web user under which account this virtual host is enabled. Thus, user may log on by his name and password to connect by FTP to the virtual host FTP directory.
- {anonymous} - if anonymous FTP is switched on, anonymous connection may be installed by the outsider.
- the list of virtual FTP users with their base64-encoded passwords.

/hsphere/local/config/ftpd/proftpd.conf - configuration file. It includes the user FTP configuration file and sites/index.conf file.

Virtual FTP Traffic Calculation

Cron runs the /hsphere/shared/scripts/cron/ftp_anlz.pl script daily to collect virtual FTP traffic statistics.

The script parses the virtual FTP log files and writes traffic statistics into the timestamp-named /hsphere/local/var/statistic/dd.mm.YYYY.ftp.txt statistics files.

The TrafficLoader Java class utility is launched by cron to process anonymous FTP traffic statistics and load it to the system database. TrafficLoader also calls the /hsphere/shared/scripts/xfer_cat.pl to gzip outdated statistics files and move them into the loaded directory where they are stored as dd.mm.YYYY.ftp.txt.gz archives.

 

Cartika Information

Customer Resources