Installation


Upgrades


DTC-Xen Installation


DTC-Xen / Dom0 Howtos

DTC-Xen / DomU Howtos

FAQ


DTC Howtos


Manuals


Features


Roadmap


Devel docs


Wiki - i18n


Wiki - Meta


ManageWWW

This page contains notes about web server management issues.

Log Files

You should know that log files don't just exist in /var/log

   /var/www/sites/petworld/petworld.co.nz/subdomains/www/logs#

They also exist in the users log folder.

   tail -f error.log 

Use this command to watch errors for a specific site.

Managing logging with .htaccess

   php_flag log_errors off
   php_flag ignore_repeated_errors on
   php_flag ignore_repeated_source on

Put these commands in the sites .htaccess file and php will stop reporting errors into the log.

It is considered smarter to simply rotate logs faster so you can still check if a site goes nuts.

Log Rotate

The logrotate within dtc is configured as "weekly", so won't catch a misbehaving domain.

You can edit /etc/dtc/logrotate.template to modify the logrotate parameters to suit.

logrotate 3.8+ has some good options that would suit you, so running wheezy or above will be fine. Otherwise you'll need to grab a squeeze backport, or compile your own backport.

If you're having trouble with a domain then we suggest setting the maxsize parameter to be 500MB, and timeperiod of weekly, and then run logrotate every 4 hours. For most of your domains, you would get 5 weeks of error log history, but for this domain you'd get 5 lots of 500MB files, and hence reduce your file system usage and risk of full disks.

If you can't upgrade logrotate, you can change the template to be minsize 500MB, timeperiod of hourly, and then run logrotate every hour. That way it will only rotate the error.log when it reaches 500MB, but for your dodgy domain it will rotate it quickly, leaving 2.5 gig rolling logs rather than blowing out to 30gig.

For more information this thread in our dev list by Javier and Damien is interesting reading.

http://www.gplhost.sg/lists/dtcdev/msg04025.html(approve sites)

Monitoring the web log

   /var/log/apache2# tail -f other_vhosts_access.log | grep petworld

This command will tail the web log for 'petworld'.

Note: DTC puts web site logs into the files called: other_vhosts_access.log

Turning off Apache logging.

You can reduce the noise in your Apache error logs by turning down the logging.

See: http://httpd.apache.org/docs/2.4/mod/core.html#loglevel(approve sites)

   LogLevel emerg 

In DTC you put this command in the 'Custom apache directives' section of the User administration

So choose your customer, Domain config, then in the vHost column select 'Customize' for the domain you want to set, then choose your subdomain from the list shown (as you can do this for more than just the default www domain) then DTC will display the "Configuration of the subdomain" for your selection.

After you've saved your changes you will either need to wait until the next cron job runs or run it manually from the command line.

   php /usr/share/dtc/admin/cron.php

Tip: On my system I set up an alias for some useful commands. I did this by putting the following in my .bashrc in my home folder.

   alias t='traceroute'
   #This one displays the content of the mail queue
   alias mq='qshape incoming active deferred'
   #This one runs mtr, mtr is like top for traceroute.
   alias m='mtr'
   #I'm always in the interfaces folder to set up IP addresses for ssl certs.
   alias ni='nano /etc/network/interfaces'
   #You need to run this when you make significant changes to the set up and I found it useful when I'm setting up a new DTC or renaming one of our VPSs.
   alias dtc-i='/usr/share/dtc/admin/install/install'
   #When spammers hit this is useful for deleting all the mail in the queue.  WARNING - this will delete all the mail in the active queue, including anything that's currently valid.
   alias mqd='postsuper -d ALL'
   #I added this alias when I was having problems with people with compromised accounts logging in to send spam.  It's useful to keep track of who's putting mail in your system.
   alias mqu='tail -f /var/log/mail.log | grep  sasl_username='
   #This one just follows the mail log
   alias mqt='tail -f /var/log/mail.log'
   #This one retarts the cron job that takes DTC settings from the database and pushes them into the Linux configuration files.
   alias dtccron='php /usr/share/dtc/admin/cron.php'
   #I can never remember where the DTC code is, so I make a little alias. :)
   alias dtccode=' cd /usr/share/dtc/admin'


Editing this page means accepting its license.

Page last modified on October 16, 2015, at 02:32 AM EST