Apache is a freely available Web server that is distributed under an "open source" license. Version 2.0 runs on most Unix-based operating systems, According to a Netcraft (www.netcraft.com) Web server survey 60% of all Web sites on the Internet are using Apache making Apache more widely used than all other Web servers combined.
Features of Apache 2.0
Unix Threading
On Unix systems with POSIX threads support, Apache can now run in a hybrid multiprocess, multithreaded mode. This improves scalability for many, but not all configurations.
New Build System
The build system has been rewritten from scratch to be based on autoconf and libtool. This makes Apache's configuration system more similar to that of other packages.
Multiprotocol Support
Apache now has some of the infrastructure in place to support serving multiple protocols. mod_echo has been written as an example.
Filtering
Apache modules may now be written as filters which act on the stream of content as it is delivered to or from the server. This allows, for example, the output of CGI scripts to be parsed for Server Side Include directives using the INCLUDES filter in mod_include. The module mod_ext_filter allows external programs to act as filters in much the same way that CGI programs can act as handlers.
Simplified configuration
Many confusing directives have been simplified. The often confusing Port and BindAddress directives are gone; only the Listen directive is used for IP address binding; the ServerName directive specifies the server name and port number only for redirection and vhost recognition.
Install Apache
There are 3 ways to install Apache:
1. Install through Yum
2. Install RPM package
Yum (Yellowdog Updater Modified)
Install through yum is simple. Just execute the following command to install
#yum install
RPM Package Manager
Installing through RPM Package manager requires a bit more work. Normally we will install from the CD/DVD-ROM provided. If in any case a CD/DVD-ROM is not available, we will have to download the rpm file from online source.
a) Navigate to the source, which most like be the CD/DVD-ROM. The source CD/DVD-ROM have to be inserted first.
#cd /media/RHEL_5.3\x86\DVD/server
b) Install RPM
#rpm –ivh httpd*
Setting up Apache Server
•The following steps are performed on the instructor computer
•Log in as root
The following commands checks if the web server is installed on the instructor computer
#chkconfig --list httpd
From the image above (fig1.1) Apache Server is installed but all run level are off. You can type the following command to ensure that the Apache starts in run level 3 and 5.
#chkconfig –level 35 httpd on
Type the following command to start the Apache services and go to web browser and navigate to http://localhost. To ensure that the default web page is up
This command allows you to view the main Apache Server Configuration File.
#nano /etc/httpd/conf/httpd.conf
You can stall the html files at this directory. As you can see there are two folder here.
#/var/www/html
Setting up Apache Server Virtual Web hosting
Ensure that you have the folders that you are trying to and in each folder will need to have a index.html for testing purpose.
You have to enter the following command in order to configure the httpd configuration for Virtual Hosting
#nano /etc/httpd/conf/httpd.conf
You can use the template documents as the end of the document as a guide for creating the configuration or connection for the virtual hosting .
Add in the following lines to configure the gajchung web hosting. _____________________________________
Disable Directory Listing
For example, you create a subdirectory named /home/www/gajchung/example under www.gajchung.com's Document Root. You'll be able to view the contents of the file gajchung.example.html in this subdirectory if you point your browser to:
www.gajchung.com/example/gajchung.example.com.html
You can disable the Directory Listing by typing the following commands in the
#nano /etc/httpd/conf/httpd.conf
Checking Syntax
You can check the work that you have done to create virtual hosts with the following command:
#httpd –S
User-Based Security
Limit access to the webpage to authorized users with password by adding the following commands into the
AuthType Basic
AuthName “ Internal Use Only:
AuthUserFile /etc/httpd/webpass
Require user gajchung
Adding the user
Adding the user to be able to access to the Document Root Folders
#useradd –g users www
#chown –R www:users /home/www
#chmod 755 /home/www
You can test the new ownership command by typing
#11 /var/www/gajchung/index.*
Here is the result which is tested on the Instructor Computer . If you have set the Apache Web hosting properly
1) /etc/init.d/httpd start : Start the web daemon
2) /etc/init.d/httpd stop : Stop the web daemon
3) /etc/init.d/httpd restart : Stop the daemon and then start it quickly
4) /etc/init.d/httpd reload : Reload the configuration files
5) /etc/init.d/httpd status : Obtain the daemon status
6) /etc/init.d/httpd -help : Obtaining a list of init script
7) /etc/init.d/httpd configtest : Test your Apache Configuration
