Logo Background RSS

» admin

  • Move account via whm/ssh
    By on February 9th, 2009 | 1 Comment1 Comment Comments

    To move an account to another server you need whm or ssh but if account is big in size
    then it is not possible by whm you need ssh by root access.
    Follow the commands below:

    TO PACK ANY ACCOUNT:

    /scripts/pkgacct nameoftheuser

    TO MOVE ONE TAR FILE TO ANOTHER SERVER. IT REQUIRES SERVER ROOT PASSWORD:

    scp /home/name_of_tar_file root@IP_DESTINY_SERVER:/home/ name_of_tar_file

    Restoring Packed Account:

    /scripts/restorepkg nameoftheuser

    Hope you all like this :D

  • Get Email when someone Login by root
    By on February 9th, 2009 | 2 Comments2 Comments Comments

    Hi friends everybuddy wanted security about their webserver and updated everytime
    you can get an email when anybuddy login via root though ssh.

    To accomplish this you will need to edit the file .bash_profile.
    At command prompt type the below command:

    pico .bash_profile

    At the end of the file add following code:

    echo ‘ALERT – Root Access from:’ `date` `who` | mail -s “Alert: Root Access from `who | awk ‘{print $6}’`” admin@gmail.com

    Replace this with your email “admin@gmail.com”

    If  anybuddy login via ssh root  then you will recieve an email.

  • Useful url rewriting using .htaccess
    By on February 4th, 2009 | 5 Comments5 Comments Comments

    If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I’ve given five useful examples of URL rewriting using .htacess. If you don’t know something about url rewriting then please check my older post about url rewriting using .htaccess.

    Now let’s look at the examples

    1)Rewriting product.php?id=12 to product-12.html

    It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL.

    RewriteEngine on
    RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1

    2) Rewriting product.php?id=12 to product/ipod-nano/12.html

    SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.

    RewriteEngine on
    RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2

    3) Redirecting non www URL to www URL

    If you type yahoo.com in browser it will be redirected to www.yahoo.com. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection?? Please check the post about SEO friendly redirect (301) redirect in php and .htaccess.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^optimaxwebsolutions\.com$
    RewriteRule (.*) http://www.optimaxwebsolutions.com/$1 [R=301,L]

    4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz

    Have you checked zorpia.com.If you type http://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

    5) Redirecting the domain to a new subfolder of inside public_html.

    Suppose the you’ve redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new” folder.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.test\.com$
    RewriteCond %{REQUEST_URI} !^/new/
    RewriteRule (.*) /new/$1

    So guys enjoy with .htaccess :)

  • check ram size in Linux
    By on February 4th, 2009 | 1 Comment1 Comment Comments

    you can use this command to find the ram size in your linux machine

    free

    Mem is Ram size in bytes. Use -m option for output in MB.
    SWAP is the size of SWAP partition.

    free -m

    Looks like you’re using up a lot of memory. Top displays your memory usage a little better as far as the “easy to read” factor goes.

    top

  • Install mod_limitipconn For Apache
    By on February 2nd, 2009 | 1 Comment1 Comment Comments

    Installing mod_limitipconn.c :o

    This is the distribution page for the Apache module mod_limitipconn.c, which
    allows web server administrators to limit the number of simultaneous
    downloads permitted from a single IP address.

    Why did I write this module? Well, I run an mp3 server which since its
    inception was being constantly hosed by people who were trying to download
    dozens of files at once. For months I scoured the Internet looking for a
    code snippet that would solve this problem. The closest thing I found was this
    patch against an old version of Apache, and it didn’t run properly on my Linux box
    (that was back then; nowadays, the patch doesn’t even apply cleanly to the
    Apache source tree).

    Finally I gave up and decided to write something to do the job myself, and
    here’s the result.
    =================
    Log into ssh

    (Apache 1.3.x) -
    cd /usr/src
    http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz
    tar xzvf mod_limitipconn-0.04.tar.gz
    cd mod_limitipconn-0.04

    (Apache 2.0.x)
    cd /usr/src
    http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz
    tar xzvf mod_limitipconn-0.22.tar.gz
    cd mod_limitipconn-0.22

    pico Makefile
    find the line that reads APXS=apxs
    change that to
    APXS=/usr/local/apache/bin/apxs

    press cntrl O to save
    then cntrl X

    // if your locations to apxs is different
    locate apxs and copy the path
    then paste that in
    //

    make
    make install

    service httpd restart

    pico -w /etc/httpd/conf/httpd.conf

    locate ExtendedStatus
    Make sure ExtendedStatus is on and without the comment at the start

    and add this line to every virtual directory you want to limit
    or add it once to the main directory to limit all

    MaxConnPerIP 3
    # exempting images from the connection limit is often a good
    # idea if your web page has lots of inline images, since these
    # pages often generate a flurry of concurrent image requests
    NoIPLimit image/*

    MaxConnPerIP 1
    # In this case, all MIME types other than audio/mpeg and video*
    # are exempt from the limit check
    OnlyIPLimit audio/mpeg video

    press cntrl O to save
    then cntrl X
    then service

    httpd restart
    :D When i try it i have limit /download location and works really good. so dude enjoy :)

  • Restoring The Database via SSH
    By on February 1st, 2009 | 3 Comments3 Comments Comments

    Restoring The Database via SSH

    Login with ssh on your hosting server.

    then goto mysql

    mysql -u dbusername -p databasename < backupname.sql

    • dbusername => Your database user name
    • databasename => Your Database name
    • backupname.sql (with full path where your sql file present)
    • then hit enter
    • it will ask your password of database
    • then click enter

    If your hosting company has you on a remote MySQL server, such as mysql.yourhost.com, you will need to add the servername to the command line. The servername will be the same as in your config.php. The command line will be:

    mysql -h servername -u dbusername -p databasename < backupname.sql

    Or:

    mysql -h servername -u dbusername -p databasename < /path/to/backupname.sql

    Now you guys have any difficulty post your comments here :)