Hosting Tips & Tricks

Plesk9 client migrations with SSL certs.

There is a thing good to know when migrating plesk 9 accounts which are using SSL certificates because “All certificates are reset when domain is restored”.

just read following article:

http://forum.parallels.com/showpost.php?p=395046&postcount=39


Plesk windows file manager need to upload larger files

By default a client can’t upload files in plesk file manager larger then ~30MB . Unfortunately we have to let them upload bigger files because they like to use the  archive “uncompress” feature from file manager.

The error received in plesk is:

HTTP Error 404.13 – Not Found

The request filtering module is configured to deny a request that exceeds the request content length.

All you have to do to solve this :

%windir%\system32\inetsrv\appcmd set config “PleskControlPanel/” -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600

which will set a 100MB limit for file uploads in plesk file manager.


Linux (centos) binary prelink issues

Today on a Cpanel server after nightly upgrade , our firewall (csf) detected some changed files. Then I run bellow verify command :

#rpm -qfV /bin/bash
prelink: /bin/bash: at least one of file’s dependencies has changed since prelinking
S.?…..    /bin/bash

I had never seen this before, but apparently rpm is doing something different now that prelink is present. Note that the ‘5′ was replaced by ‘?’ which I take to mean that RPM doesn’t know if the checksum matches or not.

No, there was no hacking attempt . you just have to run /etc/cron.daily/prelink, and when that’s done, no more binary files issues.


How to renew plesk services ssl certificates (self signed)

For Parallels Plesk Panel version 7.x, 8.x:

Server -> Certificates -> Add New Certificate

For Parallels Plesk Panel version 9.x:

Settings -> SSL Certificates -> Add SSL Certificate

Fill in required preferences and click button {Self-Signed}

New self-signed SSL certificate will be created in server certificate repository.

To assign this SSL certificate for securing your Parallels Plesk Panel mark enabled new SSL certificate in the list and push Secure control panel if you have Plesk 8.2 or later, or Install if you have older Plesk version.
Also, see Plesk documentation how to setup self-signed certificates.

After you created or uploaded new certificate into Plesk and wish to use it for domains you should set it for every IP you need, so domains use it when you access them via HTTPS.
It can be done on page Server -> IP Addresses -> “choose IP” by selecting needed Certificate in “SSL Certificate” drop down menu.

or

I use 1 SSL cert for plesk control-panel, pop3s, imaps and smtps.

After generating the new certificate in the administrator repository. make it your default certificate and mark it again and press setup to install it on your plesk admin server on port 8443. then put the certificate at your main ip-adresse in your ip-pool(maybee this step is not necessary).

copy /usr/local/psa/admin/conf/httpsd.pem
to
/usr/share/courier-imap/pop3d.pem, /usr/share/courier-imap/imapd.pem and /var/qmail/control/servercert.pem

please have a look that the owner(very important) and the chmod rights are the same of pop3d.pem, imapd.pem and servercert.pem. like before otherwhise qmail will for example not work/start, because it can’t read the file.

restart courier(imap,pop3) and qmail(smtp) in the plesk server service control panel.

after this plesk control-panel 8443, pop3s, imaps and smtps should work without warning messages and with only 1 ssl cert, if you use for all services the same main hostname.domain.com address like me.

(maybee you should also have a look, that the same hostname is configured in the qmail config file)

finally to test certificates :

openssl s_client -connect [host]:993

openssl s_client -connect [host]:995

openssl s_client -connect [host]:465

openssl s_client -connect [host]:8443

where for e.g. host=localhost


Apache did not start

Error log contains:

[emerg] (28)No space left on device: Couldn’t create accept lock
or
[crit] (28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed
Checking your disk shows that you have plenty of space. The problem is that apache didn’t shut down properly, and it’s left myriads of semaphore-arrays left, owned by my apache-user. Run:-

For CPanel :

ipcs -s | grep nobody
Removing these semaphores immediately should solve the problem and allow apache to start.
ipcs -s | grep nobody | perl -e ‘while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}’

For Plesk :

ipcs -s | grep apache
Removing these semaphores immediately should solve the problem and allow apache to start.
ipcs -s | grep apache | perl -e ‘while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}’


How to restore plesk 8 backup on plesk 9 server

Copy backup to plesk9 server and run:

/usr/local/psa/bin/pre9-backup-convert -v convert -d /var/lib/psa/dumps/  /root/plesk8-backup-file

then go to plesk 9 panel and restore the backup from the client and/or precreated domain.



How to add VisualWebGUI-Page extension to Windows2008/IIS7

step1:-

in Add Script Map dialog enter:
Request path: *.wgx
Executable: C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Name: VisualWebGUI-Page
Then click Request Restrictions…
Clear Checkbox: Invoke handler only if request is mapped to:
Click OK
Click OK again on Add Script Map
Step2:-

Change the application pool to classic.net apppool at basicsettings tab in under Actions menu.

Step3:-

give iis_iusers read permissions for web.config


MySQL Tip: MySQL Server Has Gone Away Or Lost connection to server during query

A much dreaded MySQL error message during queries is “MySQL server has gone away”. An alternative message is “Lost connection to server during query”. This is a strange problem which afflicts a wide variety of PHP software including but not limited to WordPress. There are several causes for it. Let’s look at the common and some rare causes and what you can do to fix it.

The most common causes are:
1. The server timed out and closed the connection. By default, the server closes the connection after 8 hours or 28800 seconds if nothing has happened. You can change the time limit by setting the wait_timeout variable when you start mysqld via your server’s /etc/my.cnf (on Linux; locate the file in installation directory on windows) as well. This mostly affects persistent connections; connections opened using mysql_pconnect() in PHP. It can also affect pooled connections from say any server side connection pooling.

2. Another common reason to receive the MySQL server has gone away error is because you have issued a “close” on your MySQL connection and then tried to run a query on the closed connection. This is a simple logic problem. Are you sharing the connection across multiple threads?

3. You got a timeout from the TCP/IP connection on the client side. This may happen if you have been using the commands: mysql_options(…, MYSQL_OPT_READ_TIMEOUT,…) or mysql_options(…, MYSQL_OPT_WRITE_TIMEOUT,…). In this case increasing the timeout, as described above, may help solve the problem.

4. You have encountered a timeout on the server side and the automatic reconnection in the client is disabled. Please refer to the article linked above for details and solution.

5. You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by setting the server’s max_allowed_packet variable, which has a default value of 1MB. You may also need to increase the maximum packet size on the client end. More information on setting the packet size is given in Section B.1.2.9, “Packet too large”.

6. An INSERT or REPLACE statement that inserts a great many rows can also cause these sorts of errors. Either one of these statements sends a single request to the server irrespective of the number of rows to be inserted; thus, you can often avoid the error by reducing the number of rows sent per INSERT or REPLACE.

7. You also get a lost connection if you are sending a packet 16MB or larger if your client is older than 4.0.8 and your server is 4.0.8 and above, or the other way around.

Few rare causes are:
1. Rarely the db administrator may have killed the running thread with a KILL statement or a mysqladmin kill command.

2. A client application running on a different host does not have the necessary privileges to connect to the MySQL server from that host.

3. You are using a Windows client and the server had dropped the connection (probably because wait_timeout expired) before the command was issued. The problem on Windows is that in some cases MySQL doesn’t get an error from the OS when writing to the TCP/IP connection to the server, but instead gets the error when trying to read the answer from the connection.

4. Prior to MySQL 5.0.19, even if the reconnect flag in the MYSQL structure is equal to 1, MySQL does not automatically reconnect and re-issue the query as it doesn’t know if the server did get the original query or not.

5. It is also possible to see this error if hostname lookups fail (for example, if the DNS server on which your server or network relies goes down). This is because MySQL is dependent on the host system for name resolution, but has no way of knowing whether it is working — from MySQL’s point of view the problem is indistinguishable from any other network timeout.

6. You may also see the MySQL server has gone away error if MySQL is started with the –skip-networking option.

7. You can also encounter this error with applications that fork child processes, all of which try to use the same connection to the MySQL server. This can be avoided by using a separate connection for each child process.

8. Another networking issue that can cause this error occurs if the MySQL port (default 3306) is blocked by your firewall, thus preventing any connections at all to the MySQL server.

9. You have encountered a bug where the server died while executing the query. Source

It takes time and effort to identify and solve these problems. Speaking from experience it is often not what it looks in the first place. Don’t assume anything, diligently rule out all possibilities till you solve it.


Verify installed rpm’s

For those who don’t like to RTFM, bellow can find codes for verifying rpm’s:

for e.g.

rpm -qfV /usr/sbin/sshd
S.5….T  c /etc/pam.d/sshd
S.5….T  c /etc/ssh/sshd_config

explains into:

S file Size differs
M Mode differs (includes permissions and file type)
5 MD5 sum differs
D Device major/minor number mismatch
L readLink(2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs


How to modify plesk qmail local delivery and/or add actions to it

when I try to implement other local delivery software for e.g. I need to modify .qmail file when a new email account is created/updated via plesk . if you just edit .qmail it will be rewrite on any email account update from plesk and same for new accounts you have to provision this shit somehow.

for example you can modify local delivery in .qmail to replace  “/usr/bin/deliverquota ./Maildir” with something like “/var/qmail/bin/preline -f /opt/libexec/dovecot/deliver -d user@domain”.

basically there are two ways to do that from plesk:

one is using event handlers: http://download1.swsoft.com/Plesk/Plesk8.6/Doc/en-US/plesk-8.6-unix-administrators-guide/22819.htm

second is using mail handlers: http://download1.parallels.com/Plesk/Plesk8.6/Doc/en-US/plesk-8.6-unix-mod-api/38611.htm