Top Nav

Archive | Plesk

Fixing “504 Gateway Timeout” Errors On Plesk With Nginx

If your Plesk server is configured to run Nginx in from of Apache then you may encounter “504 Gateway Timeout” errors when executing long running PHP pages.  Nginx is acting as a reverse proxy for Apache. The “proxy_read_timeout” configuration setting in Nginx controls how long Nginx will wait for Apache to return a response. The default is 60 seconds which may be too short if you have a script that takes several minutes to run. To increase this timeout, just edit /etc/nginx/nginx.conf and add the highlighted line:

Don’t forget to restart Nginx after making the change.

1

To Many PHP Session Files

I seen several servers with high traffic PHP sites hosted on Plesk servers building up an excessive number of PHP session files in /var/lib/php/session. Typically we discover this problem when the server runs out of inodes on the root filesystem.

Plesk provides a cronjob that runs hourly to clean up PHP session files:

For low traffic sites this script work just fine. But for high traffic sites with thousands of sessions per hour the script is too slow and can’t keep up with the rate that files are created.

The problem is the script check each files using the “fuser” utility to determine if the file is in use. This is a slow process. So on these high traffic servers I’ve found it necessary to remove the “fuser” check. Edit /etc/cron.hourly/plesk-php-cleanuper and change this line:

to:

Now the session cleanup will run smoothly.

0

Plesk Upgrade Fails Due To /root/.my.cnf

Had a Plesk upgrade fail with the following errors:

After extensive Google searches finally found the answer – the server had a /root/.my.cnf file with credentials, which were valid, but the simple presence of that file breaks the Plesk upgrade.

Removing/renaming the file makes the upgrade, or rather, the bootstrap repair, run fine.  That bootstrap command, by the way, can be run to repair the failed upgrade:

Then running the autoinstaller again finishes any unfinished upgrade tasks.

0

Plesk 11.5 And Apache Log Files

Plesk 11.5 makes some changes in how Apache log files are handled. Here are some notes:

1) Plesk 11.5 moves several directories out of the old vhosts/domain.com/, to vhosts/system/domain.com/. This includes conf, etc, pd, and statistics

2) Apache now puts the logs in vhosts/system/domain.com/logs. It creates a symlink at vhosts/system/domain.com/statistics/logs.

3) Plesk creates hard links in vhosts/domain.com/logs/ to the logs in vhosts/system/domain.com/logs/.  This lets FTP users download the logs but keeps the “real” logs in a safe place (“real” is in quotes, because with hard links, both locations are equally real – but the FTP-user-visible ones are owned by root, so the user can’t delete or mess with them).

4) The moral of the story is – don’t delete logs files in either location, or it screws up the hard links. If you have to delete a log, delete it in both places, restart apache, then manually recreate the hard link in the vhosts/domains.com/logs/ folder.  Or even better, instead of deleting, do a “echo -n > error_log”, for example, to zero out the file without messing with the hard links (and then restart apache).

0

Plesk 11.5 with Multiple PHP Versions

The latest version of Plesk support multiple PHP versions. The user or admin can select the version from the control panel.

Once you have the PHP versions installed use  the /usr/local/psa/bin/php_handler utility to inform Plesk. for example:

Also here’s an article that shows how to build the alternate version on Debian, including accurate info about necessary patches:

http://zgadzaj.com/how-to-install-php-53-and-52-together-on-ubuntu-1204

 

0