Thursday, July 12, 2012

Setting Apache di Ubuntu

1. HTTPD - Apache2 Web Server


1.1. Installation
The Apache2 web server is available in Ubuntu Linux. To install Apache2:

       • At a terminal prompt enter the following command:

                  sudo apt-get install apache2



1.2. Configuration
Apache2 is configured by placing directives in plain text configuration files. These directives are
separated between the following files and directories:
   • apache2.conf  : the main Apache2 configuration file. Contains settings that are global to Apache2.

   • conf.d : contains configuration files which apply globally to Apache2. Other packages that use
       Apache2 to serve content may add files, or symlinks, to this directory.

   • envvars : file where Apache2 environment variables are set.


   • httpd.conf : historically the main Apache2 configuration file, named after the httpd daemon.
      Now the file is typically empty, as most configuration options have been moved to the below
      referenced directories. The file can be used for user specific configuration options that globally
      effect Apache2.

   • mods-available : this directory contains configuration files to both load modules and configure
      them. Not all modules will have specific configuration files, however.

   • mods-enabled : holds symlinks to the files in /etc/apache2/mods-available. When a module
     configuration file is symlinked it will be enabled the next time apache2 is restarted.

   • ports.conf: houses the directives that determine which TCP ports Apache2 is listening on.

   • sites-available : this directory has configuration files for Apache2 Virtual Hosts. Virtual Hosts
      allow Apache2 to be configured for multiple sites that have separate configurations.

   • sites-enabled : like mods-enabled, sites-enabled contains symlinks to the /etc/apache2/sitesavailable               directory.
      Similarly when a configuration file in sites-available is symlinked, the site configured by it will be active      once Apache2 is restarted.



In addition, other configuration files may be added using the Include directive, and wildcards can be
used to include many configuration files. Any directive may be placed in any of these configuration
files. Changes to the main configuration files are only recognized by Apache2 when it is started or
restarted.


The server also reads a file containing mime document types; the filename is set by the TypesConfig
directive, typically via /etc/apache2/mods-available/mime.conf, which might also include
additions and overrides, and is /etc/mime.types by default.


1.2.1. Basic Settings
This section explains Apache2 server essential configuration parameters. Refer to the Apache2
Documentation for more details.


Apache2 ships with a virtual-host-friendly default configuration. That is, it is configured with a
single default virtual host (using the VirtualHost directive) which can modified or used as-is if you
have a single site, or used as a template for additional virtual hosts if you have multiple sites. If left
alone, the default virtual host will serve as your default site, or the site users will see if the URL
they enter does not match the ServerName directive of any of your custom sites. To modify the
default virtual host, edit the file /etc/apache2/sites-available/default.
The directives set for a virtual host only apply to that particular virtual host. If a directive
is set server-wide and not defined within the virtual host settings, the default setting is
used. For example, you can define a Webmaster email address and not define individual
email addresses for each virtual host.
If you wish to configure a new virtual host or site, copy that file into the same directory with a
name you choose. For example:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mynewsite



Edit the new file to configure the new site using some of the directives described below.
• The ServerAdmin directive specifies the email address to be advertised for the server's
administrator. The default value is webmaster@localhost. This should be changed to an email
address that is delivered to you (if you are the server's administrator). If your website has a
problem, Apache2 will display an error message containing this email address to report the problem
to. Find this directive in your site's configuration file in /etc/apache2/sites-available.

• The Listen directive specifies the port, and optionally the IP address, Apache2 should listen on.
If the IP address is not specified, Apache2 will listen on all IP addresses assigned to the machine
it runs on. The default value for the Listen directive is 80. Change this to 127.0.0.1:80 to cause
Apache2 to listen only on your loopback interface so that it will not be available to the Internet,
to (for example) 81 to change the port that it listens on, or leave it as is for normal operation. This
directive can be found and changed in its own file, /etc/apache2/ports.conf

• The ServerName directive is optional and specifies what FQDN your site should answer to. The
default virtual host has no ServerName directive specified, so it will respond to all requests that
do not match a ServerName directive in another virtual host. If you have just acquired the domain
name ubunturocks.com and wish to host it on your Ubuntu server, the value of the ServerName
directive in your virtual host configuration file should be ubunturocks.com. Add this directive to
the new virtual host file you created earlier (/etc/apache2/sites-available/mynewsite).
You may also want your site to respond to www.ubunturocks.com, since many users will assume
the www prefix is appropriate. Use the ServerAlias directive for this. You may also use wildcards
in the ServerAlias directive.
For example, the following configuration will cause your site to respond to any domain request
ending in .ubunturocks.com.
ServerAlias *.ubunturocks.com



The DocumentRoot directive specifies where Apache2 should look for the files that make up the
site. The default value is /var/www, as specified in /etc/apache2/sites-available/default. If
desired, change this value in your site's virtual host file, and remember to create that directory if
necessary!
Enable the new VirtualHost using the a2ensite utility and restart Apache2:

sudo a2ensite mynewsite
sudo service apache2 restart


Be sure to replace mynewsite with a more descriptive name for the VirtualHost. One method
is to name the file after the ServerName directive of the VirtualHost.


Similarly, use the a2dissite utility to disable sites. This is can be useful when troubleshooting
configuration problems with multiple VirtualHosts:

sudo a2dissite mynewsite
sudo service apache2 restart

Tuesday, July 10, 2012

Membatasi Traffik Jaringan


Membatasi Traffik Jaringan Pada Cisco Switch

Kasus :  ada komputer yang terkena virus atau user nakal dengan download speed sehingga traffik  tinggi dan mengganggu user lain


perintah ini mulai pada cisco IOS versi 12.2(25). Contoh dengan Switch 2960 Series. Misalnya ada port switch dengan speed default 100Mbps, lalu kita ingin melimitasi menjadi 10Mb. Caranya adalah dengan menerapkan QOS pada switch tersebut :
Switch(config)# interface FastEthernet 0/1
Switch(config-if)# srr-queue bandwidth limit 10
Dengan perintah “srr-queue bandwidth limit 10″ maka kita akan melimitasi bandwith untuk outbound packetnya jadi tinggal 10% dari bandwith interfacenya. Jadi hanya 10Mb.
Jika ingin melimit bandwith hanya 1 Mb saja, Caranya adalah dengan mengganti terlebih dahulu speed pada interface tersebut menjadi 10Mb, kamudian baru dilimit dengan “srr-queue bandwidth limit 10″
Switch(config)# interface FastEthernet 0/1
Switch(config-if)# speed 10
Switch(config-if)# srr-queue bandwidth limit 10
Untuk lebih detail mengenai QOS pada switch 2950 silahkan lihat disini http://www.cisco.com/en/US/docs/switches/lan/catalyst2960/software/release/12.2_37_se/con