One of the primary uses for Monkeycosm is to host a website. Website hosting is done with Apache 2.2 on the machine delta.
Website Hosting Configuration
The primary configuration file for website hosting is copied to ~/example.com/configs/httpd for your reference. This is an apache virtual host config. The default one is below.
# See http://httpd.apache.org/docs/2.2/ for detailed webserver docs.
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /home/username/example.com/htdocs/
ServerName www.example.com
ErrorLog /home/username/example.com/logs/error_log
CustomLog /home/username/example.com/logs/access_log combined
<Directory /home/username/example.com/htdocs>
AllowOverride All
</Directory>
</VirtualHost>
# This VirtualHost redirects requests for the url without www
# to the www version of the url.
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /home/username/example.com/htdocs/
ServerName example.com
ErrorLog /home/username/example.com/logs/error_log
CustomLog /home/username/example.com/logs/access_log combined
Redirect / http://www.example.com/
</VirtualHost>
This config uses ~/example.com/htdocs/ as the root of the website. That directory is created for you. The user apache must be able to navigate to this directory. By default your own home directory has it’s group set to the group usernameweb, which includes apache and you with permissions that will allow apache to see in to that directory.
Logs for the domain are at ~/example.com/logs/. access_log and error_log are the current log files being used by the webserver. ~/example.com/configs/logrotate contains the config that deals with rotating the log files. Below is the default config.
# every month, rotate access_log and error_log to
# access_log.1 and error_log.1, shifting each number up one.
# 99 of each log file will be kept.
/home/username/example.com/logs/*log {
monthly
rotate 99
notifempty
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
chown username /home/username/example.com/logs/*.?
endscript
}
The default config will keep log files for 99 weeks, after that time, the oldest log file will be deleted. You are welcome to muck with any of the log files ending in a number. You can read/process the primary log files (access_log and error_log) while they are still in use, but you can not move, edit, or otherwise muck with them. Sub-directories of the logs dir are not touched.