24×7servermanagement.com

P r o f e s s i o n a l — M a n a g e m e n t — S o l u t i o n s
RSS icon Email icon Home icon
  • FTP Error “530 Valid Hostname is expected”

    Posted on March 4th, 2011 Admin No comments

    When connecting to IIS7 using FTP you get the following error.

    Response: 530 Valid hostname is expected.
    Error: Could not connect to server

    Reason

    When you set up name-based FTP services IIS7 wants the sitename defined with the username so that IIS7 can associate the username with the site they wish to log in to.

    If you are having more than one FTP site on your VPS you will need to access FTP via following method.

    Host: Mydomain.com
    User: Mydomain.com|Username

    Note the “|” that seperates the Sitename and the Username.

    OR you remove the “Host Name” defined in the “Bindings” property of the FTP site.

    Share/Save/Bookmark

  • Register 32-bit dynamic-link library (dll) on 64-BIT Windows 2008 server

    Posted on December 3rd, 2010 Admin No comments

    Here is the method on how to register a 32-bit DLL file on a 64-BIT  Windows 2008 server.

    When you attempt to run Regsvr32.exe to register a 32-bit dynamic-link library (DLL) on a 64-bit version of Windows via command prompt, you may receive certain error messages, This behavior occurs because the Regsvr32.exe file in the System32 folder is a 64-bit version. When you run Regsvr32 to register a DLL, you are using the 64-bit version by default.

    So what you need to do is either move the DLL file into C:\Windows\syswow64  then change the path to C:\Windows\syswow64 folder and run the following command

    regsvr32.exe filename.dll

    OR

    run Regsvr32.exe from the %SystemRoot%\Syswow64 folder.  For example, type the following commands to register the DLL:

    cd \windows\syswow64

    regsvr32 c:\filename.dll

    Any of the above methods can work for you, Just make sure you are using the correct regsvr32 file from the specified location. Once again The Syswow64 folder contains the 32-bit versions of Windows program files and DLLs.

    Share/Save/Bookmark

  • Adding .svc extension with IIS – Windows 2008

    Posted on November 13th, 2010 Admin No comments

    To verify that the svc file type is mapped correctly in IIS 7.0

    1.      Open a command prompt window and type start inetmgr to open the Internet Information Services (IIS) MMC snap-in.

    2.      In the left pane, expand the node with the computer’s name, then expand the Web Sites node, and then select the Default Web Site.

    3.      Double-click Handler mappings in the Features View.

    4.      In the list of application mappings, verify that the .svc file is mapped to the aspnet_isapi.dll. If the file has not been mapped:

    1. Click Add Managed Handler.

    2. Type *.svc into the Request path:.

    3. Type System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 into the Type textbox.

    4. Type svc-Integrated into the Name: textbox.

    5. Click OK.

    6. Click Add Script Map.

    7. Type *.svc into the Request path:.

    8. Type %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll into the Executable: text box.

    9. Type svc-ISAPI-2.0 into the Name: text box.

    10. Using the Move Up/Move Down controls, ensure that the managed handler (svc-Integrated) appears before the aspnet_isapi (svc-ISAPI-2.0) handler in the list.

    11. Click OK.

    Share/Save/Bookmark

  • PHP Warning: Unknown: POST Content-Length of 28 bytes exceeds the limit of -2147483648 bytes in Unknown on line 0

    Posted on September 13th, 2010 Admin No comments

    If you are noticing the above error in apache error logs and having problems for login scripts the problem is with post_max_size variable in php.ini

    Here is what you need to do, Find out the correct php.ini configuration file.

    root@server [/usr]# php -i | grep php.ini

    Configuration File (php.ini) Path => /usr/local/lib
    Loaded Configuration File => /usr/local/lib/php.ini

    Edit the loaded php.ini file and check for post_max_size variable value, Set it to 8M which is best recommended.

    root@server [/usr]# grep post_max /usr/local/lib/php.ini

    post_max_size = 8M

    Then restart apache, That should resolve the problem.

    Share/Save/Bookmark

  • Upgrade Mysql on Plesk CentOS Linux

    Posted on August 10th, 2010 Admin No comments

    We had successfully upgraded from Mysql 5.0 to Mysql 5.1.47 along with PHP on one of our plesk server. Please use this solution if you notice any package conflicts, or other concerns with using 5.1 in your environment. Like PHP, this will be a full change to the newer packages and the 5.0 series will be retired. The procedure is quite simple

    1.) wget -q -O – http://www.atomicorp.com/installers/atomic.sh | sh

    2.)  To upgrade:

    yum –enablerepo=atomic-testing upgrade mysql

    Thats it,  And if you simply want to upgrade php run “yum upgrade php”

    With the above methods mysql will be upgraded to latest release without any problems.

    Share/Save/Bookmark

  • Manual Installation of Nginx in Cpanel Apache in proxy mode

    Posted on July 22nd, 2010 Admin 1 comment

    1. In order to get the cPanel server ready for nginx – you must first install an apache module called mod_rpaf

    Login as root:
    # cd /usr/local/src
    # wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
    # tar xvzf mod_rpaf-0.6.tar.gz
    # cd mod_rpaf-0.6
    # /usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c


    2. Doing so will install the module into the Apache module directory.

    Then Go to your  Web Host Manager (WHM) follow the tree here:
    Main >> Service Configuration >> Apache Configuration > Include Editor > Pre Main Include and Select the apache version that is running on your cPanel server. and then add following code section there, and replace (place your ips here without the brakets) with the list of IP addresses on your Cpanel server:

    ==================================================
    LoadModule rpaf_module modules/mod_rpaf-2.0.so

    RPAFenable On
    # Enable reverse proxy add forward

    RPAFproxy_ips 127.0.0.1  (place all your ips here without the brakets)

    RPAFsethostname On
    # let rpaf update vhost settings allowing to have
    # the same hostnames as in the “actual” configuration for the
    # forwarding apache installation

    RPAFheader X-Real-IP
    # Allows you to change which header we have mod_rpaf looking for
    # when trying to find the ip the that is forwarding our requests

    ===================================================

    3. Once this is completed – we are ready to move Apache to another port. To move the apache to another port follow the below:

    Go to your WHM  >> “tweak settings”  and change the apache port from 80 to 81 (find 0.0.0.0:80 and change it to 0.0.0.0.:81)

    4. Do the following

    # /usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

    5. Check your “/usr/local/apache/conf/httpd.conf”  for any occurrences of port 80,
    #  vi /usr/local/apache/conf/httpd.conf

    Find for port 80 if you found any occurrences of port 80 then rebuild your apache configuration file by running
    # /scripts/rebuildhttpdconf   and make sure your httpd.conf file is up to date

    6. Then run
    # /etc/init.d/httpd restart

    7. Now install Nginx. You must install pcre library in order to install Nginx on your cPanel server:

    # wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.9.tar.gz
    # tar xvzf pcre-7.9.tar.gz
    # cd pcre-7.9
    # ./configure
    # make
    # make install

    Now Install Nginx

    #wget http://sysoev.ru/nginx/nginx-0.7.63.tar.gz
    # tar xvzf nginx-0.7.63.tar.gz
    # cd nginx-0.7.63
    # ./configure
    # make
    # make install

    9. Create nginx.sh file and put the below code section to the file :

    # vi  nginx.sh
    ===================================================================
    #!/bin/sh

    cat > “/usr/local/nginx/conf/nginx.conf” <<EOF
    user  nobody;
    # no need for more workers in the proxy mode
    worker_processes  2;

    error_log  logs/error.log info;

    worker_rlimit_nofile  8192;

    events {
    worker_connections  1024; # you might need to increase this setting for busy servers
    use epoll; #  Linux kernels 2.6.x change to epoll
    }

    http {
    server_names_hash_max_size 2048;

    include    mime.types;
    default_type  application/octet-stream;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    keepalive_timeout  10;

    gzip on;
    gzip_min_length  1100;
    gzip_buffers  4 32k;
    gzip_types    text/plain application/x-javascript text/xml text/css;
    ignore_invalid_headers on;

    client_header_timeout  3m;
    client_body_timeout 3m;
    send_timeout     3m;
    connection_pool_size  256;
    client_header_buffer_size 4k;
    large_client_header_buffers 4 32k;
    request_pool_size  4k;
    output_buffers   4 32k;
    postpone_output  1460;

    include “/usr/local/nginx/conf/vhost.conf”;
    }

    EOF

    /bin/cp /dev/null /usr/local/nginx/conf/vhost.conf

    cd /var/cpanel/users
    for USER in *; do
    for DOMAIN in `cat $USER | grep ^DNS | cut -d= -f2`; do
    IP=`cat $USER|grep ^IP|cut -d= -f2`;
    ROOT=`grep ^$USER: /etc/passwd|cut -d: -f6`;
    echo “Converting $DOMAIN for $USER”;

    cat >> “/usr/local/nginx/conf/vhost.conf” <<EOF
    server {
    access_log off;

    error_log  logs/vhost-error_log warn;
    listen    80;
    server_name  $DOMAIN www.$DOMAIN;

    location ~* \.(gif|jpg|jpeg|png|ico|wmv|3gp|avi|mpg|mpeg|mp4|flv|mp3|mid|js|css|html|htm|wml)$ {
    root   $ROOT/public_html;
    }

    location / {
    client_max_body_size    10m;
    client_body_buffer_size 128k;

    proxy_send_timeout   90;
    proxy_read_timeout   90;

    proxy_buffer_size    4k;
    # you can increase proxy_buffers here to suppress “an upstream response
    #  is buffered to a temporary file” warning
    proxy_buffers     16 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;

    proxy_connect_timeout 30s;

    proxy_redirect  http://www.$DOMAIN:81   http://www.$DOMAIN;
    proxy_redirect  http://$DOMAIN:81   http://$DOMAIN;

    proxy_pass   http://$IP:81/;

    proxy_set_header   Host   \$host;
    proxy_set_header   X-Real-IP  \$remote_addr;
    proxy_set_header   X-Forwarded-For \$proxy_add_x_forwarded_for;
    }
    }
    EOF
    done
    done

    ===================================================================================

    8. Save the file and change the permision and then run :
    # chmod 755 nginx.sh
    # sh nginx.sh

    9. Now Check the  Nginx configuration
    #/usr/local/nginx/sbin/nginx -t

    =============================
    Great install instructions, everything worked fine just some additional info if you get error like  invalid event type “rtsig” when you run this commmand: # /usr/local/nginx/sbin/nginx -t

    To correct this error you should do this: vi /usr/local/nginx/conf/nginx.conf
    Find line 11 and change “rtsig” to “epoll” .

    This error occures in case your server is using kernel 2.4.x
    ===============================

    10. Restart Nginx
    # /usr/local/nginx/sbin/nginx

    11. create init script

    # vi /etc/init.d/nginx
    And put the below code section to the file:
    ========================================================================
    #!/bin/sh
    #
    # nginx – this script starts and stops the nginx daemin
    # Taken from http://www.hikaro.com
    # chkconfig:   – 85 15
    # description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
    #               proxy and IMAP/POP3 proxy server
    # processname: nginx
    # config:      /usr/local/nginx/conf/nginx.conf
    # pidfile:     /usr/local/nginx/logs/nginx.pid

    # Source function library.
    . /etc/rc.d/init.d/functions

    # Source networking configuration.
    . /etc/sysconfig/network

    # Check that networking is up.
    [ "$NETWORKING" = "no" ] && exit 0

    nginx=”/usr/local/nginx/sbin/nginx”
    prog=$(basename $nginx)

    NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf”

    lockfile=/var/lock/subsys/nginx

    start() {
    [ -x $nginx ] || exit 5
    [ -f $NGINX_CONF_FILE ] || exit 6
    echo -n $”Starting $prog: ”
    daemon $nginx -c $NGINX_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
    }

    stop() {
    echo -n $”Stopping $prog: ”
    killproc $prog -QUIT
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
    }

    restart() {
    configtest || return $?
    stop
    start
    }

    reload() {
    configtest || return $?
    echo -n $”Reloading $prog: ”
    killproc $nginx -HUP
    RETVAL=$?
    echo
    }

    force_reload() {
    restart
    }

    configtest() {
    $nginx -t -c $NGINX_CONF_FILE
    }

    rh_status() {
    status $prog
    }

    rh_status_q() {
    rh_status >/dev/null 2>&1
    }

    case “$1″ in
    start)
    rh_status_q && exit 0
    $1
    ;;
    stop)
    rh_status_q || exit 0
    $1
    ;;
    restart|configtest)
    $1
    ;;
    reload)
    rh_status_q || exit 7
    $1
    ;;
    force-reload)
    force_reload
    ;;
    status)
    rh_status
    ;;
    condrestart|try-restart)
    rh_status_q || exit 0
    ;;
    *)
    echo $”Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}”
    exit 2
    esac

    ========================================================================================

    11. save the code and execute
    # chmod +x /etc/init.d/nginx

    12. make it start when the server run
    # /sbin/chkconfig nginx on

    13.You can run following command to check if its running:

    # service nginx start
    # service nginx stop
    # service nginx restart
    # service nginx reload
    # service nginx configtest
    # service nginx status

    14. To Create an automatic virtualhost entry in nginx virtualhost configuration  (/usr/local/nginx/conf/vhost.conf)  when cPanel account get created on the server follow the below instructions:

    Go to the cPanel script that is :

    # vi /scripts/postwwwacct
    # chmod 755 /scripts/postwwwacct

    and put the same code that is used in “nginx.sh” in the step 9 and it will create an virtualhost entry to the nginx.

    15.To remove virtualhost entry from nginx virtualhost configuration (/usr/local/nginx/conf/vhost.conf)  when cPanel account get terminated from the server follow the below instructions:

    Go to the cPanel script that is :

    # vi /scripts/postwkillacct
    # chmod 755 /scripts/postwkillacct

    and put the same code that is used in “nginx.sh” in the step 9 and it will create an virtualhost entry to the nginx.

    DONE!! Cheers!!!!

    Share/Save/Bookmark

  • Domain unable to unsuspend in Plesk 9.5

    Posted on July 21st, 2010 Admin 1 comment

    After upgrading plesk to latest release one of our domain on plesk server was unable to unsuspend thus giving the following error.

    “Warning: The domain is still suspended for the following reason: Domain is temporarily suspended for backing up or restoring”

    Though it appear to be backup issue but backups were not running for the domain making it quite confusing, So we had the following method to unsuspend the domain.

    Login into shell and ran the following command.

    /usr/local/psa/bin/domain -u domain.com -status enabled

    Segmentation fault

    Voila !! So here is the problem plesk binaries is showing segmentation fault so it appears that the plesk upgrade didn’t go properly.  Plesk itself work on these binaries which here appears to be a problem.  Now Login into plesk and under “Updates ” select the plesk base package option and re-install the Plesk Base packages to make the plesk binaries working again.  You should receive a email when the updates are completed.

    Follow the steps to reconfigure the domain in plesk database.

    Reconfigure Domain:

    /usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=domain.com

    Change the status for domain

    /usr/local/psa/bin/domain -u domain.com -status enabled

    You should get a message the Object successfully enabled, Thats it the domain should be unsuspended in Plesk.

    Share/Save/Bookmark

  • Simple Steps to install mod_flvx with Apache

    Posted on July 5th, 2010 Admin No comments

    Today we had to install mod_flvx on CentOs server and here are the steps you need to do. I guess you have already installed Apache web server being cpanel server.  Just be sure that you have apache 2.2 version on the server or else you might have errors during compiling mod_flv.

    Download mod_flvx.c

    cd /usr/src

    wget http://github.com/osantana/mod_flvx/blob/master/mod_flvx.c

    Compile and install module:

    /usr/local/apache/bin/apxs -i -a -c mod_flvx.c

    Add the following handler in /usr/local/apache/conf/httpd.conf

    AddHandler flv-stream .flv

    Reload configuration:

    service httpd restart

    Share/Save/Bookmark

  • ffmpeg-php compile error – make: *** [ffmpeg_frame.lo] Error 1

    Posted on July 4th, 2010 Admin No comments

    If you are getting the following error while compiling the latest release of ffmpeg-php-0.6.0 , This will article will let you know how to get this fix.

    Error:
    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_toGDImageâ:
    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: âPIX_FMT_RGBA32â undeclared (first use in this function)
    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_ffmpeg_frameâ:
    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: âPIX_FMT_RGBA32â undeclared (first use in this function)
    make: *** [ffmpeg_frame.lo] Error 1

    Solution:-

    Under the ffmpeg-php-0.6.0 directory modify the file: ffmpeg_frame.c with nano or vi editor and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

    # nano ffmpeg_frame.c
    # Search for PIX_FMT_RGBA32 and replace it with PIX_FMT_RGB32
    # Exit from the editor

    Then run the following commands:

    # cd /usr/local/src/ffmpeg-php-0.6.0
    # cp -aP ffmpeg_frame.loT ffmpeg_frame.lo
    # make clean
    # ./configure
    #   make
    #   make install

    This should fix the errors given above. Finally add the ffmpeg.so extension in php.ini and check phpinfo for the server you should see ffmpeg listed.

    Share/Save/Bookmark

  • Hardening /tmp in Plesk

    Posted on July 2nd, 2010 Admin No comments

    Hardening /tmp location is very important as you may risk running rootkits, ircbots and trojans from that location. Today we had a similar problem with one of our plesk server where these bots were getting uploaded in /tmp location. However there is NO perfect solution to find how these are getting uploaded under /tmp but its better take preventive mesaures for not letting them execute.

    Hardening /tmp

    Since /tmp was not seperately mounted there is no need to take the backup of /etc/fstab file. However its good to take in case anything goes wrong.

    Create a separate partition for /tmp. For that we need to create a separate device with a certain space. The space allocation is actually depending on the apps running on your machine. Here I’m creating a separate device of size 100M and formatting it with ext3 filesystem.

    dd if=/dev/zero of=/dev/tmpFS bs=1024 count=100000

    mke2fs –j /dev/tmpFS

    Copying existing data which is in the /tmp directory to a sperate temporary directory.

    cp –pRf  /tmp /tmp_bkp

    Mounting the new partition that we’ve created in the /tmp directory and setting the necessary permissions.

    mount -o loop,noexec,nosuid,rw /dev/tmpFS /tmp

    chmod 1777 /tmp

    Copy the old data which is int /tmp_bkp directory to the new /tmp directory.

    cp –pRf  /tmp_bkp/* /tmp

    Finally add the following entry to the fstab to make the changes permanent.

    /dev/tmpFS /tmp ext3 loop,nosuid,noexec,rw 0 0

    That’s it. Your /tmp location is secured now.

    Share/Save/Bookmark