Showing posts with label HTTP. Show all posts
Showing posts with label HTTP. Show all posts

Shell Script To Auto Restart Apache HTTPD When it Goes Down

0 comments
This is a simple shell script tested on CentOS / RHEL / Fedora / Debian / Ubuntu Linux. Should work under any other UNIX liker operating system. It will check for httpd pid using pgrep command

Download the script and set cronjob as follows:

*/5 * * * * /path/to/script.sh >/dev/null 2>&1

Sample script
#!/bin/bash
# Apache Process Monitor
# Restart Apache Web Server When It Goes Down
# -------------------------------------------------------------------------
# Copyright (c) 2003 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# RHEL / CentOS / Fedora Linux restart command
RESTART="/sbin/service httpd restart"

# uncomment if you are using Debian / Ubuntu Linux
#RESTART="/etc/init.d/apache2 restart"

#path to pgrep command
PGREP="/usr/bin/pgrep"

# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
HTTPD="httpd"

# find httpd pid
$PGREP ${HTTPD}

if [ $? -ne 0 ] # if apache not running
then
# restart apache
$RESTART

Failure Reason: Unable to connect to port 80

2 comments
httpd failed @ Thu Aug  11 01:39:08 2009. A restart was attempted automagically.
Service Check Method:  [tcp connect]
 
Failure Reason: Unable to connect to port 80


It seems that your server is exceeding number of allowed connection. Check Apache error log:

# grep MaxClients /usr/local/apache/logs/error_log


Edit the http.conf file.

 

How to fix Error HTTP on Wordpress 2.6 Flash Uploader

3 comments
Whenever you are trying to upload an image using the flash uploader in Wordpress and received a “HTTP error”? and uploading images status stuck in crunching ……..

Solutions: The problem has something to do with mod_security, which is basically a web application firewall that protects your website from a range of attacks. So you shouldn’t turn off this module as it protects your site from such malicious attack , You can add a special rule in .htaccess file which can be found in the root folder of your Wordpress installation to get work the flash uploader.

Open the .htaccess file in your website document root and add the following lines:

  • For Apache 1.X

    <IfModule mod_security.c>
    <Files async-upload.php>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </Files>
    </IfModule>


  • For Apache 2.X

    <IfModule mod_security2.c>
    <Files async-upload.php>
    SecRuleEngine Off
    SecAuditEngine Off
    </Files>
    </IfModule>



Then try to upload the images it should be work like charm D:

How to fix HTTP Error on Wordpress 2.6 Flash Uploader

0 comments
Whenever you are trying to upload an image using the flash uploader in Wordpress and received a “HTTP error”? and uploading images status stuck in crunching ……..

Solutions: The problem has something to do with mod_security, which is basically a web application firewall that protects your website from a range of attacks. So you shouldn’t turn off this module as it protects your site from such malicious attack , You can add a special rule in .htaccess file which can be found in the root folder of your Wordpress installation to get work the flash uploader.

Open the .htaccess file in your website document root and add the following lines:

  • For Apache 1.X

    <IfModule mod_security.c>

    <Files async-upload.php>

    SecFilterEngine Off

    SecFilterScanPOST Off

    </Files>

    </IfModule>


  • For Apache 2.X

    <IfModule mod_security2.c>

    <Files async-upload.php>

    SecRuleEngine Off

    SecAuditEngine Off

    </Files>

    </IfModule>