Monthly Archives: April 2014

Fix “HTTP request length 134926 (so far) exceeds MaxRequestLen” error on Linux Ubuntu

If you get a 500 error in a webpage with apache webserver and fastcgi, take a look into the apache error.log file. This can either be the global error.log or the error.log of the website where you got the error. If you find a error similar to this one:

[Fri Apr 9 02:38:12 2014] [warn] [client 100.200.100.10] mod_fcgid: HTTP request length 134926 (so far) exceeds MaxRequestLen (131072), referer: http://www.example.tld/administrator/index.php?option=com_installer

then the MaxRequestLen setting of mod_fccgid is too low. To fix that, edit the file /etc/apache2/mods-available/fcgid.conf

# vi /etc/apache2/mods-available/fcgid.conf

and add or edit the line “MaxRequestLen 15728640″ to set the Request Limit to 15MB. The resulting file should contain these settings:

AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
MaxRequestLen 15728640

Save the changes and restart apache:

# /etc/init.d/apache2 restart

Deleting/viewing mail in postfix queue (mailq)

Postfix stores mails in a queue before sending it. Postfix has a command line called ‘postsuper’ which can be used to delete unsent mail from the queue. Before removing mail from the queue it is good idea to list all mail in the queue.

List all of the mail which is in the queue.
Code:

mailq

View the contents of a specific message.
Code:

postcat -q MESSAGE_ID

Remove a message from the “mailq”.
Code:

postsuper -d mailID

where mailID is the ID of the mail in the mail queue.

Delete all queued mail from the mailq.
Code:

postsuper -d ALL

Upload files with ssh / scp in Linux

The following code will transfer myfile.zip to the folder ‘myfolder’ on the server:

Code:
scp /home/username/documents/myfile.zip username@myserver.com:/home/username/myfolder/

scp = Linux command to transfer files ‘Secure Copy’
/home/username/documents/ = the directory where myfile.zip resides
myfile.zip = the file to transfer
username@myserer.com = username on myserver.com
/home/username/myfolder/ = the directory on myserver.com where myfile.zip should be transferred

You can also do the same in reverse:

Code:
scp username@myserver.com:/home/username/myfolder/myfile.zip /home/username/documents/

If you want to transfer a directory, just leave the trailing ‘/’ and add the ‘-r’ flag:

Code:
scp -r username@myserver.com:/home/username/myfolder/ /home/username/documents/

If you are connecting to Amazon hosting or need to use an identity file, try the following:

Code:
scp -v -r  -i ~/.ssh/identity.pem ~/Documents/myfolder/ username@myserver.com:/home/username/

-v Verbose – see the file transfer progress
-r Recursive – transfer a directory and all files inside
-i ~/.ssh/identity.pem Identity – use the identity file located at ~/.ssh/identity.pem
username@myserer.com = username on myserver.com
/home/username/ = the directory on myserver.com where myfolder should be transferred