Archive for the ‘General’ Category

Plesk 8.1.0 – Disabling Virtuozzo Promo

Saturday, February 24th, 2007

SWSoft decided that the wise thing to do is to start advertising their products in the control panel, effectively spamming the clients that pay a lot of money for the licenses.

To disable the promo, edit the language file, located here:


Search for the following string:

virtuozzo__promotion or virtuozzo__promotion_top

SWSoft promised that it will remove the advertising from future versions. Let’s hope they do.

Remember, you may need to edit different files for different languages.

Edit: This also works in versions 8.1.1, 8.2.0 and 8.2.1

Redirecting http:// to https:// automatically

Thursday, October 5th, 2006

To redirect all http:// traffic to the corresponding https:// traffic, we make use of a bit of mod_rewrite magic.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]

Replace with your own SSL URL.

To force SSL for a particular folder (not the entire site), use the following instead:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} somefolder
RewriteRule ^(.*)$$1 [R,L]

Replace somefolder with your folder path and with your SSL URL.

RHEL4 / CentOS 4 and kernel 2.6.9-34

Saturday, August 19th, 2006

Please be aware that certain servers running stock standard kernel 2.6.9-34, 2.6.9-34.0.1 or 2.6.9-34.0.2 may experience problems with high IO wait times. You will also notice that not all the memory on the server is used.

A patch was included in the above kernels that caused the kernel to start swapping to disk long before all the memory was used. This caused serious performance issues on some servers, running the above kernel versions.

The patch was removed from the 2.6.9-42 kernel and bliss has returned to all the servers.

kernel 2.6.9-42 is also included in the RHEL 4 Update 4 and will hopefully be included in CentOS 4.4.

Plesk 8.0.1 and pleskbackup

Saturday, August 19th, 2006

Since Plesk 8 for Unix, SW-Soft, changed the backup utility from the old psadump/psarestore utilities available in Plesk 7.5.4 and earlier to the new pleskbackup/pleskrestore utilities.

I have read a lot of posts from unhappy people about the new utilities. I can honestly say that my only complaint is that SW-Soft decided to break compatibility between the pre-Plesk 8.0 and the post-Plesk 8.0 backup utilities.

That being said, the first version of the backup utilities that I tried was for Plesk 8.0.1, with at least one, maybe 2 hotfixes applied.

I have found the new Plesk 8.0.1 backup utilities to be a lot faster and a lot easier to use than their predecessors.

Yes, the backup file is still a gzipped, MIME encoded file but at least the backup utilities now add the filenames to each MIME part, making it possible to extract the backup archive into multiple clearly named files. Then it is a simple untar of the correct part to get your data.

All in all, not too bad.

By default, the new backup utilities will split your backup file into 1GB chunks. You may change this behaviour, by setting the following variable before running the backup:

/usr/local/psa/bin/pleskbackup –all /path/to/file/FILENAMEHERE -verbose

The PLESKX_SPLIT_SIZE variable expects a number of bytes as input. In the above example we set the chunk size to 2GB.

To be able to work with the MIME files, you will need a MIME decoder. You may want to search for mpack or get ripmime.

Running suPHP and mod_php side by side on Plesk

Sunday, May 14th, 2006

By default all the Plesk servers runs mod_php for speed. This has one major drawback and that is that if a clients creates files via PHP, they are owned by the webserver user under which mod_php runs. The solution to the problem seems to enable suPHP for the clients that needs to create files via PHP.

Below is the procedure that I found to work:

  1. Download the mod_php RPM from the Dag Wiers repository:


  2. Install the mod_php RPM:

    rpm -Uvh mod_suphp-0.6.1-2.1.el3.rf.i386.rpm

  3. Disable able the mod_suphp AddHandler in /etc/httpd/conf.d/suphp.conf
  4. Your /etc/httpd/conf.d/suphp.conf, should only have the following lines:

    LoadModule suphp_module modules/
    LoadModule php4_module modules/
    suPHP_Engine off

    Putting the above into your config will default to PHP pages being run by mod_php.

  5. To switch a virtual host over to mod_suphp, use the following:

    <Directory /home/httpd/vhosts/<VHOST>/httpdocs>
    <IfModule sapi_apache2.c>
    <IfModule mod_suphp.c>
        RemoveHandler x-httpd-php
        php_admin_flag engine Off
        suPHP_AddHandler x-httpd-php .php
        suPHP_Engine on
        AddHandler x-httpd-php .php
        suPHP_UserGroup <USER> <GROUP>

    The config above will only activate if both mod_php and mod_suphp is loaded. Remember to replace the <VHOST>, <USER> and <GROUP> entries with the correct virtual host, Unix user and Unix group.

EDIT: In later versions of PHP, the CLI and CGI version are 2 separate binaries. You now need to edit the /etc/suphp.conf file to reflect the correct binary in the x-httpd-php=php:/usr/bin/php-cgi entry. To determine which binary you need to add, simple do a php -v on the command line. The binary that outputs the cgi information as part of the version information, is the correct binary.

RubyGems on RHEL3/CentOs3

Saturday, May 13th, 2006

This howto guide is based on RubyGems version 0.8.11 which was the current version at the time of writing this guide.

Download the mod_RubyGems source code from:

Extract the .tgz file to a suitable location:

cd /usr/src
tar zxvf /usr/local/src/rubygems-0.8.11.tgz
cd rubygems-0.8.11.tgz

Run the setup command:

ruby setup.rb

Now compile the program:


Finally, install ruby:

make install

It is now time to configure Apache to run with mod_ruby. Please see this post.

Howto install mod_ruby on RHEL3/CentOS3

Wednesday, May 10th, 2006

This howto guide is based on mod_ruby version 1.2.5 which was the current version at the time of writing this guide. We also need version 1.2.5, since it supports the Apache::RailsDispatcher, which is needed if we want to run RubyOnRails in our Plesk environment.

Download the mod_ruby source code from:

Extract the .tar.gz file to a suitable location:

cd /usr/src
tar zxvf /usr/local/src/mod_ruby-1.2.5.tar.gz
cd mod_ruby-1.2.5

Run the configure command:

./configure.rb --with-apxs=/usr/sbin/apxs

Now compile the program:


Finally, install ruby:

make install

It is now time to configure Apache to run with mod_ruby.

Apache::RailsDispatcher can run multiple applications in the same process. It works like this:

  • require loads libraries into the top level, and they are shared with all applications.
  • require_dependency loads libraries into an anonymous module for each application.
  • In the development environment, the anonymous module is orphaned on each request. So required_dependency loads libraries every time.
  • In the production environment, the same anonymous module is used for the same application. So required_dependency loads libraries only at once.
  • Rails configurations such as ActiveRecord::Base.colorize_logging are reset on each request.

This hack is just a workaround until YARV supports multiple VM instances. We can get it in the near future, I hope.

To use Apache::RailsDispatcher, you have to write the following configuration in httpd.conf.

RubySafeLevel 0
# If you use RubyGems
# RubyRequire rubygems
RubyRequire apache/rails-dispatcher
RubyTransHandler Apache::RailsDispatcher.instance
<Location /ruby-application-name>
    SetHandler ruby-object
    RubyHandler Apache::RailsDispatcher.instance
    RubyOption rails_uri_root /ruby-application-name
    RubyOption rails_root /path/to/rails/root
    RubyOption rails_env production

Please note that you can’t override exinting classes like this:

class Array     def cycle()         self.each_with_index {|o, i| yield(o, %w(odd even)[i % 2])}     end end

You should prepend Object:: to the class name:

class Object::Array     def cycle()         self.each_with_index {|o, i| yield(o, %w(odd even)[i % 2])}     end end

This behaivour is same as Kernel.load(filename, true). If you don’t like this, please convince Matz to change it.

Your done. You should now have a valid ruby interperter running on your server.

Portions of this post is courtesy of:

Howto: Install mod_python on Plesk

Wednesday, May 10th, 2006

This is a simple guide to install/upgrade mod_python on a Plesk RHEL box, running Apache 2.0.x. You need to have at least Python version 2.2.1 installed for this to work.

I could not get mod_python version 3.2.8 running at the time of writing.

  1. Download and extract mod_python:

    cd /usr/local/src
    tar zxvf mod_python-3.1.4.tgz

  2. Configure & install mod_python

    cd mod_python-3.1.4
    ./configure --with-apxs=/usr/sbin/apxs (check where your apxs is by typing: locate apxs)
    make install

  3. Configure Apache:

    vi /etc/httpd/conf.d/pyhton.conf

    Locate your LoadModule – section and add the following line under the others:

    LoadModule python_module modules/

  4. Installation done, now time for testing:

    First go to a publicly accessible directory. Make a test directory for mod_python by typing:

    mkdir python

    Now open vi and write the following lines:

    AddHandler python-program .py
    PythonHandler testingpython
    PythonDebug O

    save the file as .htaccess.

    Now open up vi again and copy/paste the following lines:

    from mod_python import apache

    def handler(req):
            req.write("Hello World!")
            return apache.OK

    close and save as Those are tabs not spaces. If you left align everything you will get this error:

    IndentationError: expected an indented block (, line 4)"

    Now restart Apache by typing: service httpd restart

Take your browser to and you should see “Hello World!” If you can see this message then you have succesfully installed mod_python.

Dr.Web, qmail & SpamAssassin on Plesk 7.5.4

Wednesday, May 3rd, 2006

For some reason the Dr.Web, qmail and SpamAssassin integration on Plesk sometimes does not work properly after an upgrade.

It is important to make sure that the binaries in the /var/qmail/bin directory have the following permissions, to enable Dr.Web, qmail and SpamAssassin to work together.

-r-s–x–x 1 drweb qmail 161024 Mar 19 01:34 qmail-queue
-r-s–x–x 1 drweb qmail 161024 Mar 19 01:34 qmail-queue.drweb
-r-s–x–x 1 qmailq qmail 15936 Aug 24 2005 qmail-queue.origin

The process runs as follows:

  1. Incoming mail will be delivered using the qmail-queue binary, which is a specially compiled version that allows qmail to scan the email for viruses.
  2. The qmail-queue binary will write a temporary file in the /var/drweb/spool/ directory. It is therefore important to check the permissions on the /var/drweb/spool/. They should be:

    drwxrwx— 2 drweb nofiles 4096 May 3 13:20 spool

  3. The qmail-queue binary will also read the /etc/drweb/drweb_qmail.conf file and it will execute the file found in the QmailQueue = tag, once virus scanning is complete. The QmailQueue = tag usually contains:

  4. After the virus scanning process completes, the qmail-queue.origin binary will run. This binary will in turn run the SpamAssassin rules as defined in each users configuration.

The following files maybe useful in locating a problem:

  1. /usr/local/psa/var/log/maillog – This file contains the mail logs and you will quickly see if any errors are being generated in it.
  2. /var/drweb/log/drwebd.log - This file contains the Dr.Web logs for all scanned emails.

Seeking the badblocks

Thursday, April 27th, 2006

One always learns about neat utilities when you are faced with some real problems. This is how I discovered badblocks. badblocks is a Linux command for the ext2 and ext3 file systems, maybe others. badblocks will basically scan you hard drive for any bad blocks on the drive and will mark them bad, so that the file system does not use them. The Seagate drive that made me use this utility had groups of 4 bad blocks.

The command is simply:
badblocks </dev/to/test>

Upgrading Plesk

Wednesday, March 1st, 2006

Since Plesk Reloaded version 7.5.3, one can disable the quotacheck for the upgrade procedure, which will increase the speed of the upgrade.

As per the documentation:

If PLESK_QUOTACHECK_OFF environment variable is not empty then quotacheck will be skipped during Plesk installation.

Plesk 7.5.4, MySQL 4.1.x and PHP 4.x.x

Wednesday, December 21st, 2005

Although it seems that Plesk 7.5.4 for Unix/Linux is almost compatible with MySQL 4.1.x, there is one problem with the PHP 4.x.x series, that still uses the old MySQL 3.23.x libraries to interface to MySQL. If you have the above scenario on your server you have to set MySQL 4.1.x to use the old password format or you will receive an error along the lines of:

Error (1251) : Client does not support authentication protocol requested by
server; consider upgrading MySQL client.

Adding the entry below to the [mysqld] section of your /etc/my.cnf file solves the problem:


Plesk 7.5.4 on RHEL 3

Saturday, October 29th, 2005

When I upgraded my Plesk 7.5.3 intallation to Plesk 7.5.4, I ran into a problem. The error was:

./packagemng: error while loading shared libraries: cannot open shared object file: No such file or directory

After going through all the documentation and finding nothing, I finally found a few obscure RPMs that needs to be installed. They are all in the Third_Party.RHel3/ directory.

The list that fixed the problems were:


Which bootloader am I using?

Monday, August 29th, 2005

Some of you have propably wondered many times, which bootloader you are using.

I prefer grub but sometimes systems come pre-installed with lilo.

On RHEL and clones, you may use the following command for information:

grubby --bootloader-probe

If you want to swap to grub, the following command may be of help:

grub-install /dev/hda

File Manager cant access httpdocs

Wednesday, August 17th, 2005

You receive the following error when accesing httpdocs through the control panel,

Unable to change directory to /httpdocs/: Invalid file name.

The problem is caused by invalid charachters in the files names uploaded, so fat it seems that the following could
cause the problem,

“&”, “`”, “‘ “, ” [ and ]”

The solution is to change the filenames.

Unable to remove sub domains from Plesk for windows

Monday, August 15th, 2005

The normal cause of this is that IIS lost the sub domain entry.

Without this entry you won’t be able to manage the sub domain in your Plesk Control Panel.

The entry must be re-created in IIS.

When creating the sub domain in IIS, the default path for the sub domain to use,

Once added log into the control panel and remove or edit the sub domain.

Moving tomcat4 logging on Plesk

Monday, August 8th, 2005

To add logging on a Plesk-Tomcat 4 server, to a domain name, add the following code to the server.xml file.

<logger className="org.apache.catalina.logger.FileLogger" directory="/home/httpd/vhosts/" suffix=".log" timestamp="true"/>

Make sure that the /home/httpd/vhosts/ directory have the following permissions:

drwxrwxr-x 2 root tomcat4 4096 Aug 8 17:35 tomcat4

Opensource Control Panels

Friday, August 5th, 2005

(24) Too many open files (errno: 24)

Monday, June 13th, 2005

When attempting to start apache, I received some errors indicating that I hav reached the maximum number of open files.

[error] System: Too many open files (errno: 24)

This is caused by apache and RedHat setting their open file limits too low. Be forwarned, an older system could see a serious degredation in performance by setting these limits too high. To correct this you will need to do the following:

Edit /etc/sysctl.conf. Add a new line with: fs.file-max = 8192 (The default is 1024) The change to the /etc/sysctl.conf will make the setting persistant over reboots.

To immediately increase the number of open files, use ulimit -n 8192.

To view all the current ulimit‘s. you my run: ulimit -a.

Advanced Policy Firewall (APF)

Friday, June 3rd, 2005

APF is a policy based iptables firewall system designed for ease of use and configuration. It employs a subset of features to satisfy the veteran Linux user and the novice alike. Packaged in tar.gz format and RPM formats, make APF ideal for deployment in many server environments based on Linux.

Download APF