Logo Background RSS

» Apache

  • ls: command options
    By admin on March 25th, 2009 | 9 Comments9 Comments Comments

    ls: command options

    Option Action

    -a                  list hidden files

    -d                  list the name of the current directory

    -F                  show directories with a trailing ‘/’
    executable files with a trailing ‘*’

    -g                  show group ownership of file in long listing

    -i                  print the inode number of each file

    -l                  long listing giving details about files
    and directories

    -R                  list all subdirectories encountered

    -t                  sort by time modified instead of name

  • Install mod_bandwidth
    By admin on March 23rd, 2009 | 3 Comments3 Comments Comments

    What is Mod_Bandwidth

    “Mod_bandwidth” (mod bandwidth) is a module for the Apache webserver that enable the setting of server-wide or per connection bandwidth limits, based on the directory, size of files and remote IP/domain.

    For Apache 1.3x. ONLY! This how-to is not compatible with old versions of apache, including but not limited to 1.3beta

    How to install mod_bandwidth

    1. Login to your server via SSH as root.

    2. Type: mkdir /root/mod_bw

    3. Type: cd /root/mod_bw

    4. Type: wget ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c

    5. Type: /usr/local/apache/bin/apxs -c /root/mod_bw/mod_bandwidth.c -o /usr/local/apache/libexec/mod_bandwidth.so

    6. Type: mkdir /usr/local/apache/bw_limit

    7. Type: mkdir /usr/local/apache/bw_limit/link

    8. Type: mkdir /usr/local/apache/bw_limit/master

    9. Type: pico -w /etc/httpd/conf/httpd.conf

    10. Locate the following Line: LoadModule rewrite_module libexec/mod_rewrite.so

    11. Before the above line add this:
    LoadModule bandwidth_module libexec/mod_bandwidth.so

    12. Now locate this line: AddModule mod_env.c

    13. Before the above line add this:
    AddModule mod_bandwidth.c

    14. Now locate this line: # Document types.

    15. Before the above line add this:
    BandWidthDataDir “/usr/local/apache/bw_limit”
    BandWidthModule On

    16. To enable mod_bandwidth on a virtual host locate the virtual host entry for the specified domain/acount you wish to limit. Just before the line add the following:
    BandWidthModule On
    BandWidth all 512

    The 512 can be replaced with whatever rate you wish to limit the acount too.

    17. Save the file and exit.
    CTRL-X then Y then enter.

    18. Type: service httpd restart

    19. Type: cd /usr/sbin

    20. Type: wget ftp://ftp.cohprog.com/pub/apache/module/cleanlink.pl

    What is cleanlink?
    Cleanlink is a deamon that is used to clean links created by mod_bandwidth when they aren’t removed properly by the server. (When a httpd process doesn’t terminate the usual way.)

    21. Type: chmod 755 cleanlink.pl

    22. Type: pico -w cleanlink.pl

    23. Change $LINKDIR to the following:
    $LINKDIR=”/usr/local/apache/bw_limit/link”;

    24. Save the file and exit.
    CTRL-X then Y then enter.

    25. Type: perl cleanlink.pl

    26. Type: pico -w /etc/rc.d/rc.local

    27. Scroll down to the very end of the file and add the following:
    # The following line Launches CleanLink for Mod_Bandwidth
    perl /usr/sbin/cleanlink.pl

    28. Save the file and exit.
    CTRL-X then Y then enter.

    mod_bandwidth has many options. If you wish to modify mod_bandwidth and enable more options please visit the documentation available by the programmer here: http://www.cohprog.com/v3/bandwidth/doc-en.html

  • Exim Failed – Exim is not running
    By sps on February 27th, 2009 | 6 Comments6 Comments Comments

    A restart was attempted automagically.
    Service Check Method: [check command]

    Cmd Service Check Raw Output: Exim is not running

    This is a bug in Exim
    here are the steps how i fix this problem

    Hello friends
    you can doit by SSH
    I first ran:

    /scripts/eximup –force –source

    I then removed the old exim RPM, which was preventing the correct one from

    being updated.

    I then ran:

    /scripts/eximup –force

    Exim is now up well.

    Thank you. :D

  • Get Email when someone Login by root
    By admin on February 9th, 2009 | No 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.

  • Install mod_limitipconn For Apache
    By admin on February 2nd, 2009 | No Comments 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 :)

  • All about httpd.conf
    By vinod on January 24th, 2009 | No Comments Comments
    This  httpd.conf file to set itself up for this particular configuration setup with:
    ServerType standalone

    The option ServerType specifies how Apache should run on the system. You can run it from the super-server inetd, or as standalone daemon. It’s highly recommended to run Apache in standalone type for better performance and speed.

    ServerRoot “/etc/httpd”

    The option ServerRoot specifies the directory in which the configuration files of the Apache server lives. It allows Apache to know where it can find its configuration files when it starts.

    PidFile /var/run/httpd.pid

    The option PidFile specifies the location where the server will record the process id of the daemon when it starts. This option is only required when you configure Apache in standalone mode.

    ResourceConfig /dev/null

    The option ResourceConfig specifies the location of the old srm.conf file that Apache read after it finished reading the httpd.conf file. When you set the location to /dev/null, Apache allows you to include the content of this file in httpd.conf file, and in this manner, you have just one file that handles all your configuration parameters for simplicity.

    AccessConfig /dev/null

    The option AccessConfig specifies the location of the old access.conf file that Apache read after it finished reading the srm.conf file. When you set the location to /dev/null, Apache allows you to include the content of this file in httpd.conf file, and in this manner, you have just one file that handles all your configuration parameters for simplicity.

    Timeout 300

    The option Timeout specifies the amount of time Apache will wait for a GET, POST, PUT request and ACKs on transmissions. You can safely leave this option on its default values.

    KeepAlive On

    The option KeepAlive, if set to On, specifies enabling persistent connections on this web server. For better performance, it’s recommended to set this option to On, and allow more than one request per connection.

    MaxKeepAliveRequests 0

    The option MaxKeepAliveRequests specifies the number of requests allowed per connection when the KeepAlive option above is set to On. When the value of this option is set to 0 then unlimited requests are allowed on the server. For server performance, it’s recommended to allow unlimited requests.

    KeepAliveTimeout 15

    The option KeepAliveTimeout specifies how much time, in seconds, Apache will wait for a subsequent request before closing the connection. The value of 15 seconds is a good average for server performance.

    MinSpareServers 16

    The option MinSpareServers specifies the minimum number of idle child server processes for Apache, which is not handling a request. This is an important tuning parameter regarding the performance of the Apache web server. For high load operation, a value of 16 is recommended by various benchmarks on the Internet.

    MaxSpareServers 64

    The option MaxSpareServers specifies the maximum number of idle child server processes for Apache, which is not handling a request. This is also an important tuning parameter regarding the performance of the Apache web server. For high load operation, a value of 64 is recommended by various benchmarks on the Internet.

    StartServers 16

    The option StartServers specifies the number of child server processes that will be created by Apache on start-up. This is, again, an important tuning parameter regarding the performance of the Apache web server. For high load operation, a value of 16 is recommended by various benchmarks on the Internet.

    MaxClients 512

    The option MaxClients specifies the number of simultaneous requests that can be supported by Apache. This too is an important tuning parameter regarding the performance of the Apache web server. For high load operation, a value of 512 is recommended by various benchmarks on the Internet.

    MaxRequestsPerChild 100000

    The option MaxRequestsPerChild specifies the number of requests that an individual child server process will handle. This too is an important tuning parameter regarding the performance of the Apache web server.

    User www

    The option User specifies the UID that Apache server will run as. It’s important to create a new user that has minimal access to the system, and functions just for the purpose of running the web server daemon.

    Group www

    The option Group specifies the GID the Apache server will run as. It’s important to create a new group that has minimal access to the system and functions just for the purpose of running the web server daemon.

    DirectoryIndex index.htm index.html index.php index.php3 default.html index.cgi

    The option DirectoryIndex specifies the files to use by Apache as a pre-written HTML directory index. In other words, if Apache can’t find the default index page to display, it’ll try the next entry in this parameter, if available. To improve performance of your web server it’s recommended to list the most used default index pages of your web site first.

    Include conf/mmap.conf

    The option Include specifies the location of other files that you can include from within the server configuration files httpd.conf. In our case, we include the mmap.conf file located under /etc/httpd/conf directory. This file mmap.conf maps files into memory for faster serving.

    HostnameLookups Off

    The option HostnameLookups, if set to Off, specifies the disabling of DNS lookups. It’s recommended to set this option to Off in order to save the network traffic time, and to improve the performance of your Apache web server.