Routing the world

Routing & IT System Administration

Archive for the ‘Plesk’ Category

Redirect Apache to Tomcat in Plesk 12

leave a comment »

When you have an application in Tomcat over Plesk and you want to redirect the domain to your application those are the instructions for Plesk 12:

  • Login as administrator
  • Select subscription
  • Open in control panel
  • Web server settings
  • Additional directives for HTTP && Additional directives for HTTPS:
RewriteEngine On
ProxyPass /
ProxyPassReverse /

Written by Root

July 1, 2015 at 15:59

Posted in Linux, Plesk

Tagged with , ,

Plesk Possible BUG: 11.0.9 #MU55 – Apache Webmail Wildcard missing by default

leave a comment »

I have detected a possible BUG in the default configuration of Plesk 11.0.9 at least in #MU55.

Working with the DNS Wildcard for Webmail I have found that the system does not create the ServerAlias Wildcard according to the DNS Zone in the Apache directives.

* Create a new domain with primary DNS zone
* Try to access to webmail.domain.tld. It must work correctly
* Try to access to whatever.webmail.domain.tld. It does not work and Plesk shows the default webpage.

In Plesk 11 the Apache main directives are located under /etc/httpd/conf.d/. The main file that manage the vhost directives is zz010_psa_httpd.conf.

Into this file we can find that it points to another files, generated by Plesk, for example, when you reconfigure domains with /usr/local/psa/admin/bin/httpdmng –reconfigure-all

This is how zz010_psa_httpd.conf looks like:

Include '/usr/local/psa/admin/conf/generated/13735297540.77229700_server.include'
Include '/usr/local/psa/admin/conf/generated/13735297540.77229700_horde.include'
Include '/usr/local/psa/admin/conf/generated/13735297540.77229700_atmail.include'
Include '/usr/local/psa/admin/conf/vhosts_bootstrap.conf*'

As we can see the webmails config is located under the /usr/local/psa/admin/conf/generated/

Well, this is where the possible BUG exists becouse into these files a ServerAlias directive for the wildcard should be created but it is not.

As default it creates

ServerAlias webmail.domain.tld

And it should create:

ServerAlias webmail.domain.tld
ServerAlias *.webmail.domain.tld

I think that in the /usr/local/psa/admin/conf/templates dir, where are located the files that has the configuration template info used to generate the correct configuration, are not defined the wildcard pointers in the ServerAlias, so creating this pointers will solve the problem

I hope this info could help anyone with this kind of problems.

Written by Root

July 11, 2013 at 10:10

Delete messages from Postfix Queue based on from or to addresses

leave a comment »

When you need to delete messages from a Postfix Queue based on the From or To headers you can do it using the next “one-liner” commands:

  • For message deletion in a Postfix Queue based on From address

mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($7 == "" && $9 == "") print $1 } ' | tr -d '*!' | xargs rm

  • For message deletion in a Postfix Queue based on To address

mailq | tail -n +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($8 == "" && $9 == "") print $1 } ' | tr -d '*!' | xargs rm

What changes between the two commands is the position the awk command get to make parsing in order to obtains the MSGID before push it to delete command.

You could change "xargs rm" to "wc -l" to get the number of messages affected by the message group based on the From or To address. This must be done ALWAYS BEFORE delete the messages from the queue.

UPDATE 24/04/2013: If you are using a modern version of Postfix with queue in a complex directory structure, you have to change the last argument “xargs rm” to “xargs -rn1 postsuper -d“. This is done because postsuper command can delete messages from queue in all that complex structure and you don’t need to enter each directory to be able to delete the files.

Written by Root

April 24, 2013 at 09:00

Plesk Postfix Domain Based Smarthost

with 4 comments

In many situations a client needs to redirect all his mail to another SMTP server and you have the need to convert your Plesk Server for this domain to “SMTP Transport Mode“.

This is usefull for example, when a client has a hosting server or is hosted in a multidomain environment and wants to redirect all the mail received to his corporate mail server, like a Microsoft Exchange Server.

There is very few documentation about this in Parallels Forums and I know that can be a little bit scary to modify the Plesk Postfix Configuration Files. Don’t worry, this is what you have to do in five easy steps.

    1. Edit the file /etc/postfix/ and if no set add the next two lines. In the first case, is allways defined, you have to add the last “hash”.
      virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual, hash:/etc/postfix/virtual_mailbox_maps
      transport_maps = hash:/etc/postfix/transport
    2. Create the transport file in /etc/postfix as defined before with this content. NOTE: is the domain you want to transport mail to another SMTP. smtp:[IP_or_Hosname]
    3. Create the virtual_mailbox_maps file with this content, this is done to maps all the email addresses to the end server:
    4. Make a postmap of both files, transport and virtual_mailbox_maps to make it Postfix readable
    5. Restart Postfix daemon “et voilá”

I hope this configuration will be helpfull to you. In this case leave a comment.

Retrieve Plesk FTP Password

leave a comment »

The Plesk FTP passwords for FTP users accounts for each domain are stored in the “psa” database.

To retrieve this passwords you can use this command:

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "use psa; select accounts.password from accounts INNER JOIN sys_users ON WHERE sys_users.login='xxxx';"

You have to change the “xxxx” for the username you need to retrieve the password.

Written by Root

January 16, 2012 at 23:12

Posted in Linux, Plesk

Tagged with , , ,

Plesk Linux Email Accounts Password Reveal

with one comment

A lot of times, many Plesk email users get his passwords lost.

They call to support services of the hosting provider requesting it. You can access the database to see the password what is a very tedious process.

Fortunately Parallels has implemented a command to see all passwords for all users in all domains:


You can filter the output to see one account password (quotes must exist):

/usr/local/psa/admin/bin/mail_auth_view | grep "johnsmith@domain.tld"

Also you could get statistical information about how many email accounts supports your server:

/usr/local/psa/admin/bin/mail_auth_view | wc -l

As the result you get the total amount of email accounts in you server for all the domains, of course, you could filter by domain:

/usr/local/psa/admin/bin/mail_auth_view | grep "domain.tld" | wc -l

And all the variations you can imagine.

Written by Root

July 20, 2011 at 08:51

Posted in Linux, Plesk

Tagged with

Change Plesk default language

leave a comment »

If you only have paid for a basic Plesk Licence and need to change the default language pack from english to other this are the instructions. This is a sample to change it to Spanish.

Please follow the below mentioned steps to help resolve the issue :

– Create Plesk database backup:
# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` psa > /root/psa_backup.sql

– Stop Plesk CP:
# /etc/init.d/psa stop1

– Login into Plesk database:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa

– Find what locales are available in Plesk:

mysql> select * from locales;
| id    | active |
| es-ES | false  |
| en-US | true   |

– In table ‘misc’ replace ‘en-US’ with desired locale name what you found in the step 3 ( for example ‘es-ES’) in ‘admin_locale’ and ‘def_locale’:
mysql> update misc set val="es-ES" where param in
mysql> ("admin_locale","def_locale");

– In table ‘mn_param’ replace ‘en-US’ with the desired locale:
mysql> update mn_param set val="es-ES" where val="en-US";

– In table ‘clients’ replace locale for all clients:
mysql> update clients set locale="es-ES";

– In table ‘module_watchdog_param’:
mysql> update module_watchdog_param set val="es-ES" where
mysql> param="locale";

– In ‘dom_param’ there are locales for each domain:
mysql> update dom_param set val="es-ES" where param="locale";

– Change locale for mailboxes in the ‘Parameters’ table:
mysql> update Parameters set value="es-ES" where Parameter in
mysql> ("s:locale", "s:country_locale");

– Also, in order to keep everything correct, alter locales table to display active locale correctly:
mysql> update locales set active="false" where id="en-US"; update
mysql> locales set active="true" where id="es-ES";

– Exit from MySQL:
mysql> quit

– Start Plesk CP:
# /etc/init.d/psa start

Good luck

Written by Root

July 15, 2010 at 13:10

Posted in Linux, Plesk

Tagged with

%d bloggers like this: