How to enable http compression on a Plesk server?

July 15, 2010    |   Posted by admin   |    Category: Plesk Management

What is http compression and which module to use for http compression?

Compressing data before transmitting to the browsers and then uncompressing the data before displaying. The module that is responsible for http compression is called mod_deflate.The main advantage of mod_deflate is that it saves a lot of bandwidth and loads the pages faster.

On a Plesk server, the mod_deflate module is installed by default, however it may be disabled in the Apache configuration file. To enable the mod_deflate module in Plesk edit the Apache configuration file

# vi /etc/httpd/conf/httpd.conf

Search the line that says,

#LoadModule deflate_module modules/mod_deflate.so

and uncomment it i.e. remove the ‘#’ mark

LoadModule deflate_module modules/mod_deflate.so

Now, create a /etc/httpd/conf.d/deflate.conf file. Apache reads all the .conf files from the /etc/httpd/conf.d directory on a Plesk server.

# vi /etc/httpd/conf.d/deflate.conf

and place the following code in it

<Location />
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI  \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
</Location>

Save the file and restart Apache.

# service httpd restart

This compression code will compress all the files except the .gif, .jpe, .jpeg and .png files before sending them to the browser. To test the compression, use the tool

http://www.whatsmyip.org/mod_gzip_test/

To enable compression for a specific directory or domain, specify the directory path in the <Location> directive in deflate.conf and restart the Apache server.

 

Related URLs:
Enable http compression on a Plain Linux server

qmail-inject: fatal: mail server permanently rejected message

June 21, 2010    |   Posted by admin   |    Category: Plesk Management

You may notice “qmail-inject: fatal: mail server permanently rejected message” error message while sending emails from a Plesk server

qmail-queue-handlers[xxxx]: Unable to change group ID: Operation
not permitted
qmail-queue[xxxx]: files: write buf 0xbff4dfe0[156] to fd (5)
error - (32) Broken pipe
qmail-queue[xxxx]: files: cannot write chuck from 4 to 5 - (32)
Broken pipe

The reason is the incorrect permission and/or ownership of the ‘qmail-queue’ file under the /var/qmail/bin directory.

To fix the issue, you need to make sure the ownership of the qmail-queue file is mhandlers-user:popuser and the permission are 2511.

To check the current ownership and permission of the file, execute:

# ls -la /var/qmail/bin/qmail-queue

It should be as follows:

-r-x--s--x 1 mhandlers-user popuser May 4 /var/qmail/bin/qmail-queue

If not, correct the ownership

# chown mhandlers-user.popuser /var/qmail/bin/qmail-queue

set the proper permissions,

# chmod 2511 /var/qmail/bin/qmail-queue

Restart the qmail service and the emails will work.

Comments Off on qmail-inject: fatal: mail server permanently rejected message

PleskFatalException Unable to connect to database

March 2, 2010    |   Posted by admin   |    Category: Plesk Management

On accessing the Plesk control panel you may receive the “PleskFatalException Unable to connect to database: Too many connections” error message and this is caused when the mysql connections on the server are exceeded than the specified value.

ERROR: PleskFatalException Unable to connect to database:
mysql_connect() : Too many connections 0:
/usr/local/psa/admin/plib/common_func.php3:190 psaerror (string
'Unable to connect to database: mysql_connect() Too many connections')

The temporary solution is to restart the Mysql service, and the permanent solution is to increase the max_connections value in the mysql configuration.

SSH to your server and restart the mysql service

# /etc/init.d/mysqld restart

If the problem is occurring quite frequently, you should increase the max_connections value in the my.cnf file. To check the existing max_connections value

# mysqladmin variables -uadmin -p`cat /etc/psa/.psa.shadow` \
 | grep max_connections

To increase the max_connections value, edit the /etc/my.cnf file

# vi /etc/my.cnf

and set the following parameter

max_connections = new_value

where, new_value should be the number higher than the existing mysql connections retrieved from the previous command.

Save the file and restart the Mysql service for the changes to take affect:

# /etc/init.d/mysqld restart
Comments Off on PleskFatalException Unable to connect to database

Unable to install the psa-migration-manager: db4 error

February 19, 2010    |   Posted by admin   |    Category: Plesk Management

You may receive the “Unable to install the psa-migration-manager” error message while installing Plesk. It is down to the incomplete db4 packages which provides embedded database support for various applications.

ERROR: Unable to install the “psa-migration-manager-x.x.x-cos5.build86080930.03.x86_64 package. Packages “db4-4.3.29-9.fc6.x86_64” and “db4-4.3.29-10.el5.x86_64” cannot be installed at the same time.


Solution:

Check if db4 packages are installed. You can list the db4 packages by:

# rpm -qa | grep db4

If the db4-devel and db4-utils are not listed above, install the packages using yum

# yum install db4-utils
# yum install db4-devel

Once done, start the Plesk installation again and psa-migration-manager will be installed successfully.

Comments Off on Unable to install the psa-migration-manager: db4 error

How to install SuPHP/phpSuExec on Plesk?

January 24, 2010    |   Posted by admin   |    Category: Plesk Management

How to install SuPHP/phpSuExec on a Plesk server?

SuPHP Or PHPSuExec is a module that increases the security of the server and executes PHP files under the ownership of the owner of the file instead of the Apache user i.e. “apache”.

The advantages of having suPHP are:

1. Files and Directories those need 777 permissions to write into, via the browser will now need a maximum of 755 permissions. The files/directories with 777 permissions will result in an “Internal Server Error”.

2. If you need to manipulate the value of a php directive for a domain, for ex. register_globals, it needs to be placed in the php.ini of a domain instead of the .htaccess file as it will result in an “Internal Server Error”.

3. All the files and directories uploaded using a script will have the ownership of the user instead of user ‘apache’ (i.e. the Apache user).

4. A user can edit/remove the files using Ftp that are uploaded via the browser.

In order to install SuPHP on the server, download and install the atomic script

# wget -q -O - http://www.atomicorp.com/installers/atomic | sh

Once the script is installed, install SuPHP module using yum

# yum install mod_suphp

The next step is to load the SuPHP module with Apache. The suphp installation automatically creates a “suphp.conf” file under the Apache configuration directory, if not create it.

# vi /etc/httpd/conf.d/suphp.conf

and insert the following lines:

#Load the Mod_SuPHP module
LoadModule suphp_module modules/mod_suphp.so
php_admin_value engine off
# Enable handlers
suPHP_AddHandler x-httpd-php
AddHandler x-httpd-php .php .php3 .php4 .php5
#Enable the SuPHP engine
suPHP_Engine on

Apache calls all the configuration files from the /etc/httpd/conf.d directory by default so there is no need to include the module in the httpd.conf file separately.

Now,  configuration file under /etc should be present (if not create it)

vi /etc/suphp.conf

copy/paste the following contents as it is:

[global]
logfile=/var/log/suphp.log
loglevel=info
webserver_user=apache
docroot=/var/www/vhosts
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false
check_vhost_docroot=false
errors_to_browser=false
env_path=/bin:/usr/bin
umask=0022
min_uid=500
min_gid=500

[handlers]
x-httpd-php="php:/usr/bin/php-cgi"
x-suphp-cgi="execute:!self"

Make sure the “handle_userdir” directive is commented or removed from the file since it is deprecated from the latest version.

At the end, we have to restart the httpd service for all these changes to take effect

# service httpd restart

Test the SuPHP installation: Create a phpinfo.php file with 777 permission and it should show you an “Internal Server Error” on browsing.

Related Links:
How to install/enable SuPHP on a cPanel server?