Archive for December, 2009

Run CGI scripts in httpdocs

Plesk only allows .cgi files to be executed from cgi-bin but allows .pl files to be executed from anywhere. To allow .cgi to be executed from httpdocs add line to .htaccess: AddHandler cgi-script .cgi

Apache case insensitive URL’s

If your moving a site from a Windows host to Linux and all of the cases are messed up (Yes Windows is case-insensitive ), you could try to substitute through all the code to make sure the links are the correct case. If your lucky though, enable mod_speling and this should work: # Add the […]

Linux at command

A useful utility for scheduling one-off tasks. atq = view scheduled jobs at -c 7 = show command to be run in job number 7 atrm 7 = delete job number 7 at -m 08:50 2009-10-15 < updatejob = schedule a job to run the contents of updatejob or type: at -m 08:50 2009-10-15 then […]

Apache MySQL Authentication

mod_auth_mysql will need to be loaded. in vhost.conf add: AuthType Basic AuthName “Auth required” AuthMySQLHost localhost AuthMySQLUser auth_user AuthMySQLPassword mypassword AuthMySQLDB mysqlauth AuthMysqlUserTable clients AuthMySQLNameField username AuthMySQLPasswordField passwd AuthMySQLPwEncryption none AuthMySQLEnable on require valid-user Then in MySQL: create database mysqlauth; use mysqlauth; CREATE TABLE `clients` ( `username` varchar(25) NOT NULL default ”, `passwd` varchar(25) NOT […]

Apache server status

Add the following to httpd.conf for resource troubleshooting: ExtendedStatus On SetHandler server-status Order deny,allow Deny from all Allow from myipaddress

Too many open files when several hundred domains in Plesk

With more than several hundred domains in plesk, issues can arise with too many open files. Solution: echo ‘ulimit -n 32768′ >> /etc/sysconfig/httpd Enabling piped logging his also helps greatly,: mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -BAND psa -e ‘REPLACE INTO misc VALUES (“apache_pipelog”,”true”)’ /usr/local/psa/admin/bin/websrvmng -a To see the default open file limit per process: ulimit -n […]

Allow directory listing in Apache

Simple I know, but I always forget. # Create a .htaccess file Options +Indexes

Adding a secondary SMTP port in Plesk

Choose an unused port and add it to the /etc/services file, for example: smtp_alt 2525/tcp # new SMTP port Make a copy of /etc/xinetd.d/smtp_psa to /etc/xinetd.d/smtp_psa_alt and correct service line within new file: service smtp_alt Restart xinetd `/etc/init.d/xinetd restart` Edit the firewall, adding port 25025

Adding a second FTP account in Plesk

Sometimes it’s necessary to have two FTP users on a domain with access to the httpdocs and/or subdirectories, which Plesk doesn’t allow by default. # Create a web user in Plesk # Change the default directory to the required one and the userid to the same as the main FTP user grep ftpuser1 /etc/passwd usermod […]

Plesk SQL Queries

A few queries I put together to grab info from the Plesk database for troubleshooting: #FTP ACCOUNTS #———— SELECT account_id AS ‘ID’, login AS ‘USERNAME’, password AS ‘PASSWORD’, home AS ‘HOMEDIR’ FROM sys_users S, accounts A WHERE S.account_id =; #MAIL ACCOUNTS #————- SELECT account_id AS ‘ID’, mail_name AS ‘USERNAME’, password AS ‘PASSWORD’, postbox as […]