Setting Up Apache in Ubuntu

|

From a technical perspective, you could say that a web server is just a special kind of file server: all it does is offer files that are stored in a dedicated directory structure. The root of this structure is called the document root, and the file format that offers the files is HTML, the hypertext markup language. But a web server can provide more than just HTML files. In fact, the web server can serve just about anything, as long as it is specified in the HTML file. Therefore, a web server is a very good source for streaming audio and video, accessing databases, displaying animations, showing photos, and much more.

Apart from the web server where the content is stored, the client also has to use a specific protocol to access this content as well, and this protocol is HTTP (the hypertext transfer protocol). Typically, a client uses a web browser to generate HTTP commands that retrieve content, in the form of HTML and other files, from a web server.

You’ll likely encounter two different versions of Apache web server. The most recent version is 2.x, and this is the one installed by default on Ubuntu Server. You may, however, encounter environments that still use the earlier 1.3. This often happens if, for instance, custom scripts have been developed for use with 1.3, and those scripts aren’t compatible with 2.x.


Apache Components
Apache is a modular web server, which means that the core server (whose role is essentially to serve up HTML documents) can be extended using a variety of optional modules. For example, the libapache2-mod-php5 module allows your Apache web server to work with scripts written in PHP 5. Likewise, many other modules are available for Apache. To give you an initial impression, I’ll list some of the most useful modules:

• libapache2-mod-auth-mysqld: This module tells Apache how to handle user authentication against a MySQL database.

• libapache2-mod-auth-pam: This module instructs Apache how to authenticate users, using the Linux PAM mechanism.

• libapache-mod-frontpage: This module instructs Apache how to handle web pages using Microsoft FrontPage extensions.

• libapache2-mod-mono: This module tells Apache how to interpret ASP.NET code.

This is a short and incomplete list of all the modules you can use on the Apache web server: http://modules.apache.org currently lists more than 450 modules. It’s important that you determine exactly which modules you need for your server so that you can extend its functionality accordingly. Now, let’s move on to the configuration of the Apache web server itself.


Starting, Stopping, and Testing the Apache Web Server
Like almost all other services you can use on Ubuntu Server, the Apache web server is not installed automatically. The two packages that are available to install Apache are the apache package and the apache2 package. At present, apache2 is the more common, and only in specific situations does it make sense to use the older apache package. To check if Apache has already been installed, use dpkg -l | grep apache. If this command doesn’t show an Apache server, install it using apt-get install apache2.

The most important part of the Apache web server is the HTTP daemon (httpd) process. This process is started from the script /etc/init.d/apache2; to run it from the command line, use /etc/init.d/apache2 start. If this command finishes without any errors, your web server is up and running, which you can check with the ps aux | grep apache command. This command shows that different instances of the Apache web server are ready and waiting for incoming connections.

After starting the Apache web server, you can test its availability in several ways. The best way, however, is to just try to connect, because, after being installed, a default web server is listening for incoming requests. So wait no longer: launch a browser and connect to HTTP port 80 on your local host. It should show you a page, it doesn’t look very nice, but that’s only because you haven’t configured anything yet.

Source of Information : Apress Beginning Ubuntu Server Administration From Novice To Professional

0 comments:

Subscribe to Computing Tech

Enter your email address:

Delivered by FeedBurner

Add to Technorati Favorites Top Blogs