Feeds:
Posts
Comments

Archive for January 24th, 2008

What is Web Server? Before we go to that question, it’s better if we know what is web.

Actually, web is only a file or document in HTML format which is transferred from 1 computer (server) to a computer (client) which requests that file/document. To read a web document you need a web client application. There are so many web client applications available, such as Mozilla, Firefox, Opera etc.

Did you get a picture what is the Web Server? Yes, Web Server is an application in a computer that supplies files or document which are requested by client computer. There are few web server available in market, such as Apache, IIS and Cold Fusion, but the most popular web server in the world is Apache. Because, almost 70% web servers in the world use Apache.

Apache is under GPL. So, you can use it for free.

Apache2 or Apache Web Server a default web server installed in Ubuntu.

Note:

  • If you are using Gutsy, you don’t have to do the installation. You have it already. You just need to configure the setting only.

  • If you want to use PHP4, you can’t use apache2, it’s designed to work with PHP5 now. You can use Xampp. With Xampp, even you can choose which PHP version that you want to use, PHP4 or PHP5, without change any configuration.

Step 1. Apache Installation

To install Apache2 in Ubuntu, just type the command below in your Terminal Console.

taufanlubis@zyrex:~$ sudo apt-get install apache2 apache2-common apache2-mpm-prefork apache2-utils

……….
……….

This command will complete the installation of apache2 web server.

Step 2. Apache Configuration

The default of apache2 configuration files are located at /etc/apache2.

taufanlubis@zyrex:~$ ls -l /etc/apache2/

total 60
-rw-r–r– 1 root root 24175 2007-01-16 01:10 apache2.conf
drwxr-xr-x 2 root root 4096 2007-08-03 14:01 conf.d
-rw-r–r– 1 root root 895 2007-01-16 01:11 envvars
-rw-r–r– 1 root root 0 2007-08-03 14:01 httpd.conf
drwxr-xr-x 2 root root 12288 2007-09-07 08:00 mods-available
drwxr-xr-x 2 root root 4096 2007-10-03 22:26 mods-enabled
-rw-r–r– 1 root root 10 2007-08-03 14:01 ports.conf
drwxr-xr-x 2 root root 4096 2007-09-07 08:00 sites-available
drwxr-xr-x 2 root root 4096 2007-08-03 14:01 sites-enabled

taufanlubis@zyrex:~$

 

Step 2A. Apache Configuration —sites-available

To change it, just edit ‘default‘ file at /etc/apache2/sites-available

taufanlubis@zyrex:/$ cd /etc/apache2/sites-available/
taufanlubis@zyrex:/etc/apache2/sites-available$ ls
default

taufanlubis@zyrex:/etc/apache2/sites-available$ sudo gedit default
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

 

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# This directive allows us to have apache2’s default start page
# in /apache2-default/, but still have / go to the right place
#RedirectMatch ^/$ /apache2-default/
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>

 

Step 2B. Apache Configuration —document root

If you want to change from ‘/var/www‘ to ‘/home/www‘, just change the ‘DocumentRoot /var/www‘ to be ‘DocumentRoot /home/www‘.

 

The main configuration file is located at /etc/apache2/apache2.conf.
…..
ServerRoot “/etc/apache2″
PidFile /var/run/apache2.pid
ErrorLog /var/log/apache2/error.log
Include /etc/apache2/ports.conf

 

Additional Apache Configuration —Enable some Apache modules (Note: If need it!!!!)

SSL, rewrite, suexec and include

As you can see above, Apache2 supports a lot of modules and uses DSO (Dynamic Shared Object). DSO will make each module easier to be developed and maintained.

 

Additional Apache Configuration —Add new Modules to Apache2

taufanlubis@zyrex:~$ sudo a2enmod ssl
Module ssl installed; run /etc/init.d/apache2 force-reload to enable.

taufanlubis@zyrex:~$ sudo a2enmod rewrite
Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

taufanlubis@zyrex:~$ sudo a2enmod suexec
Module suexec installed; run /etc/init.d/apache2 force-reload to enable.

taufanlubis@zyrex:~$ sudo a2enmod include
Module include installed; run /etc/init.d/apache2 force-reload to enable.

taufanlubis@zyrex:~$

 

Additional Apache Configuration —Check Apache2 modules installed

taufanlubis@zyrex:~$ /usr/sbin/apache2 -l

Compiled in modules:
core.c
mod_log_config.c
mod_logio.c
prefork.c
http_core.c
mod_so.c

taufanlubis@zyrex:~$

 

Install PHP5

PHP4 is no longer supported in Feisty. If you still want to use PHP4, I suggest you to use XAMPP.

taufanlubis@zyrex:~$ sudo apt-get install php5

Password:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libapache2-mod-php5
Suggested packages:
php-pear
The following NEW packages will be installed:
libapache2-mod-php5 php5
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 2531kB/2532kB of archives.
After unpacking 5743kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://security.ubuntu.com feisty-security/main libapache2-mod-php5 5.2.1-0ubuntu1.4 [2531kB]
Fetched 2531kB in 25s (100kB/s)
Selecting previously deselected package libapache2-mod-php5.
(Reading database … 156650 files and directories currently installed.)
Unpacking libapache2-mod-php5 (from …/libapache2-mod-php5_5.2.1-0ubuntu1.4_i386.deb) …
Selecting previously deselected package php5.
Unpacking php5 (from …/php5_5.2.1-0ubuntu1.4_all.deb) …
Setting up libapache2-mod-php5 (5.2.1-0ubuntu1.4) …
Setting up php5 (5.2.1-0ubuntu1.4) …

taufanlubis@zyrex:~$

 

Install PHP5 Library

taufanlubis@zyrex:~$ sudo apt-get install libapache2-mod-php5

Reading package lists… Done
Building dependency tree
Reading state information… Done
libapache2-mod-php5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

taufanlubis@zyrex:~$

 

Install MySql for PHP5

taufanlubis@zyrex:~$ sudo apt-get install php5-mysql
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
php5-mysql
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 65.5kB of archives.
After unpacking 246kB of additional disk space will be used.
Get:1 http://security.ubuntu.com feisty-security/main php5-mysql 5.2.1-0ubuntu1.4 [65.5kB]
Fetched 65.5kB in 2s (27.7kB/s)
Selecting previously deselected package php5-mysql.
(Reading database … 156650 files and directories currently installed.)
Unpacking php5-mysql (from …/php5-mysql_5.2.1-0ubuntu1.4_i386.deb) …
Setting up php5-mysql (5.2.1-0ubuntu1.4) …

taufanlubis@zyrex:~$

 

Install phpmyadmin for php5-mysql

taufanlubis@zyrex:~$ sudo apt-get install phpmyadmin
Reading package lists… Done
Building dependency tree
Reading state information… Done
Suggested packages:
mysql-server
Recommended packages:
php5-mcrypt php4-mcrypt php5-gd php4-gd
The following NEW packages will be installed:
phpmyadmin
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 3591kB of archives.
After unpacking 14.1MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com feisty/universe phpmyadmin 4:2.9.1.1-2ubuntu1 [3591kB]
Fetched 3591kB in 49s (73.2kB/s)
Preconfiguring packages …
Selecting previously deselected package phpmyadmin.
(Reading database … 156654 files and directories currently installed.)
Unpacking phpmyadmin (from …/phpmyadmin_4%3a2.9.1.1-2ubuntu1_all.deb) …
Setting up phpmyadmin (2.9.1.1-2ubuntu1) …
Creating config file /etc/phpmyadmin/apache.conf with new version
Creating config file /etc/phpmyadmin/config.footer.inc.php with new version
Creating config file /etc/phpmyadmin/config.header.inc.php with new version
Creating config file /etc/phpmyadmin/config.inc.php with new version
Creating config file /etc/phpmyadmin/htaccess with new version

taufanlubis@zyrex:~$

 

Check your apache2 modules installed.

taufanlubis@zyrex:~$ sudo apt-cache search apache2 (may different with yours)
libapache2-mod-auth-mysql – Apache 2 module for MySQL authentication
libapache2-mod-auth-pam – module for Apache2 which authenticate using PAM
libapache2-mod-auth-pgsql – Module for Apache2 which provides pgsql authentication
libapache2-mod-auth-plain – Module for Apache2 which provides plaintext authentication
libapache2-mod-auth-sys-group – Module for Apache2 which checks user against system group
libapache2-mod-macro – Create macros inside apache2 config files
libapache2-mod-python – Apache 2 module that embeds Python within the server
libapache2-mod-python-doc – Apache 2 module that embeds Python within the server
libapache2-svn – Subversion server modules for Apache
adzapper – proxy advertisement zapper add-on
libapache-mod-dav – A DAV module for Apache
libapache-mod-jk-doc – Documentation of libapache-mod-jk/libapache2-mod-jk packages
libapache-ruby1.8 – Ruby libraries for mod_ruby
libapache2-mod-annodex – Provides server-side support for Annodex media

libapache2-mod-apreq2 – generic Apache request library – Apache module

libapache2-mod-auth-kerb – apache2 module for Kerberos authentication

libapache2-mod-bt – BitTorrent tracker for the Apache2 web server

libapache2-mod-bt-dev – Header files for mod_bt

libapache2-mod-chroot – run Apache in a secure chroot environment

libapache2-mod-dnssd – Apache 2 module which adds Zeroconf support via avahi

libapache2-mod-encoding – Apache2 module for non-ascii filename interoperability

libapache2-mod-fcgid – an alternative module compat with mod_fastcgi

libapache2-mod-geoip – GeoIP support for apache2

libapache2-mod-ifier – Filter and reject incoming client requests

libapache2-mod-jk – Apache 2 connector for the Tomcat Java servlet engine

libapache2-mod-layout – Apache2 web page content wrapper

libapache2-mod-ldap-userdir – Apache2 module that provides UserDir lookups via LDAP

libapache2-mod-mime-xattr – Apache2 module to get MIME info from filesystem extended attributes

libapache2-mod-mono – Run ASP.NET Pages on UNIX with Apache 2 and Mono

libapache2-mod-musicindex – Browse, stream, download and search through MP3/Ogg/FLAC files

libapache2-mod-ngobjweb – Apache2 module for the SOPE application server

libapache2-mod-proxy-html – Apache2 filter module for HTML links rewriting

libapache2-mod-removeip – Module to remove IP from apache2’s logs

libapache2-mod-rpaf – module for Apache2 which takes the last IP from the ‘X-Forwarded-For’ header

libapache2-mod-ruby – Embedding Ruby in the Apache2 web server

libapache2-mod-scgi – Apache module implementing the SCGI protocol

libapache2-mod-shib – Shibboleth implements the OASIS SAML v1.1 specification,

libapache2-mod-speedycgi – apache2 module to speed up perl scripts by making them persistent

libapache2-mod-suphp – Apache2 module to run php scripts with the owner permissions

libapache2-mod-vhost-hash-alias – Fast and efficient way to manage virtual hosting

libapache2-mod-vhost-ldap – Apache 2 module for Virtual Hosting from LDAP

libapache2-mod-xmlrpc2 – XMLRPC Server module for Apache2 web server

libapache2-modbt-perl – Perl bindings for mod_bt

libapache2-modxslt – XSLT processing module for Apache 2.0.x based on libxml2

libapache2-redirtoservname – Apache 2 module to redirect users to the canonical hostname

libapache2-request-perl – generic Apache request library – Perl modules

libapache2-webauth – Apache 2 modules for WebAuth authentication

libapache2-webkdc – Apache 2 modules for a WebAuth authentication KDC

libembperl-perl – A system for building dynamic websites with Perl

libnet-bittorrent-libbt-tracker-perl – Perl bindings for libbttracker

mod-chroot-common – run Apache in a secure chroot environment

mod-musicindex-common – Common files for mod-musicindex

modxslt-doc – Documentation for modxslt

mono-apache-server – backend for mod_mono Apache module

mono-apache-server2 – backend for mod_mono2 Apache module

nanoweb-contrib – user contributed utilities for Nanoweb

php5-apache2-mod-bt – PHP bindings for mod_bt

rt3.4-apache2 – Apache 2 specific files for request-tracker3.4

rt3.6-apache2 – Apache 2 specific files for request-tracker3.6

torrus-apache – Universal front-end for Round-Robin Databases (for apache 1.x)

torrus-apache2 – Universal front-end for Round-Robin Databases (for apache 2.x)

torrus-common – Universal front-end for Round-Robin Databases (common files)

libapache2-mod-fastcgi – Apache 2 FastCGI module for long-running CGI scripts

apache2-mpm-itk – multiuser MPM for Apache 2.2

libapache2-mod-perl2 – Integration of perl with the Apache2 web server

libapache2-mod-perl2-dev – Integration of perl with the Apache2 web server – development files

libapache2-mod-perl2-doc – Integration of perl with the Apache2 web server – documentation

libapache2-mod-php5 – server-side, HTML-embedded scripting language (apache 2 module)

php5-cgi – server-side, HTML-embedded scripting language (CGI binary)

libapache2-mod-cband – An Apache 2 module for bandwidth limiting the webserver

apache2 – Next generation, scalable, extendable web server

apache2-doc – documentation for apache2

apache2-mpm-event – Event driven model for Apache HTTPD 2.1

apache2-mpm-perchild – Transitional package – please remove

apache2-mpm-prefork – Traditional model for Apache HTTPD 2.1

apache2-mpm-worker – High speed threaded model for Apache HTTPD 2.1

apache2-prefork-dev – development headers for apache2

apache2-src – Apache source code

apache2-threaded-dev – development headers for apache2

apache2-utils – utility programs for webservers

apache2.2-common – Next generation, scalable, extendable web server

taufanlubis@zyrex:~$

 

Update your Apache2

taufanlubis@zyrex:~$ sudo apt-get update

taufanlubis@zyrex:~$ sudo apt-get upgrade

 

Test your Apache2

Open your web browser (ex. Firefox).

Type ‘localhost‘, if you get ‘It works!’ message mean that your succeed.

 

Read Full Post »

Follow

Get every new post delivered to your Inbox.

Join 75 other followers