apache server installation & configuration
TRANSCRIPT
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 1/19
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 2/19
Outline
Introduction to ubuntu Introduction to Apache2
Installation of apache Some Features Activating the User's public_html Directory Domain Mapping Creating Virtual Directory
Objective
Our objective of this project is the installation of apache2 on Linux (ubuntu) and configures
it. We have tried to implement as more as possible functions of apache2 web server.
Introduction to UBUNTU
Ubuntu is a free, stable, and secure OS. Ubuntu comes at a tempting price and provides many
of the advantages of popular commercial operating systems such as Windows and OS X. But
it also has potential drawbacks — manual installation and possible compatibility issues.
Ubuntu is an operating system developed by a worldwide community of programmers and byemployees of Ubuntu's commercial sponsor, Canonical. Ubuntu is based on the concept of
free or open-source software, meaning that you do not pay any licensing fees for Ubuntu, and
you can download, use, and share the operating system free of charge.
As it is Linux-based operating system, Ubuntu has a well-deserved reputation for stability
and security. Historically, Linux has proven itself to be a workhorse server operating system,
and this is where, up until now, it has been most widely used and best known.
However, in recent years, Linux has also become valuable on desktop and laptop computers,
making it an option for individuals and businesses. Ubuntu is generally known to be the most
widely used version of Linux available. Because the software is free to download and share,
it is difficult to track exact usage numbers.
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 3/19
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 4/19
Apache Rocks
Apache is a highly configurable Web Server with a modular design. It is veryeasy to extend the capabilities of Apache Web server. Anyone with decent C or Perl
programming expertise can write a module to perform a special function. This meansthat there are tons of Apache modules available for use.Apache is a free, open source technology. Being free is important but not asimportant as being open source.Apache works great with Perl, PHP, and other scripting languages. Most Webapplications are still scripts. Perl excels in the script world and Apache makes usingPerl a piece of cake with both CGI support and mod_perl support.Apache runs on Linux and other Unix systems. Linux used to be an underdogoperating system, which has now found itself in enterprise computing arena. Linuxand Apache go hand-in- hand in the enterprise world today. I believe Linux’sacceptance in the business world has made Apache’s entry into such territory easy.However, there are people who would argue that it was Apache’s fame that madeLinux find its way into the business world easier. Either way, Apache and Linux is apowerful combination. Other Unix systems such as FreeBSD and Solaris, and the newMac OS X also play a great role in expanding Apache’s user base horizon. Apache also runs on Windows. Although Apache will run much better on Windows
platform with version 2.0, Apache was already in Windows market with Version
1.3. x. We will see a lot of Windows systems switching to Apache from Microsoft
Internet Information Server (IIS) because Apache 2.0 architecture gives it the power it
needed to compete natively.
Some of the new features include:
Unix Threading: Apache has the ability to run a hybrid multithreaded mode in Unix servers.
This process improves scalability for most configurations.
Multiprotocol Support: This features allows Apache to act as a platform for protocols other
than HTTP, enabling a machine to go far beyond the traditional web server.
Enhanced Support for Non-Unix Systems: Apache 2 is more stable and much faster on
other platforms such as Windows, which tends to perform better with Microsoft server
applications.
Filtering: The new filtering feature allows modules to be written as filters that can act on
streams of data sent to and from the server. For example, CGI scripts can be parsed for SSI
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 5/19
(server side include) directives by using the INCLUDES filter. The module filter enables
external programs to function in same manner that allows CGI programs to act as handlers.
Multilanguage Error Response: With Apache 2, SSI documents are used to send error
response messages to the web browser in various languages. These messages can be easily
customized by the system administer to get a consistent look and feel.
Easy Configuration: Most of the confusing, complex directives of the original Apache have
been simplified in version 2.0. The Server name directive gives the name of the server and
only the port number for redirection and virtual host recognition.
Unicode Support for Windows NT: On Windows NT, Apache 2.0 uses the native Unicode
for the encoding of all filenames. This enables the application to provide multi-language
support for all Windows NT systems including 2000 and XP.
Updated REL: Apache 2.0 is integrated with the Perl compatible Regular Expression
Library based on the powerful syntax of Perl version 5.
lunarpages is one of many providers who realize that Apache 2.0 is the server platform of the
future. With all the features mentioned above and others such as IPv6 (Internet Protocol
version Six) support and multi-user administration, Apache 2 has proven to be a reliable
workhorse more than able to meet the demand of today’s World Wide Web.
Uses
Apache is primarily used to serve static as well as dynamic Web pages on the World Wide
Web. Many web applications are designed expecting the environment and features that
Apache provides.
Apache is the web server component of the popular LAMP web server application stack,
alongside Linux, MySQL, and the PHP/Perl/Python (and now also Ruby) programming
languages.
Apache is redistributed as part of various proprietary software packages including the Oracle
Database or the IBM WebSphere application server. Mac OS X integrates Apache as its built-
in web server and as support for its WebObjects application server. It is also supported insome way by Borland in the Kylix and Delphi development tools. Apache is included with
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 6/19
Novell NetWare 6.5, where it is the default web server. Apache is also included with many
Linux distributions.
Installation of Apache
System RequirementsApache runs on just about any platform in use today, including Linux; FreeBSD; OpenBSD;NetBSD; BSDI; Amiga OS 3. x; Mac OS X; SunOS; Solaris; IRIX; HPUX; Digital Unix;UnixWare; AIX; SCO; ReliantUNIX; DGUX; OpenStep/Mach; DYNIX/ptx; BeOS; andWindows.
Here are some methods to install apache2:
Compiling and Installing Software from Source
We download a file that contain all the source code for the application we want to install,unpack it, and compile it on our system. Compiling is a process that turn the source code intoan executable binary code. It is a fairly straight forward process, and we find that a lot of software we install will need to be built from source.
Installing RPM's using the Redhat Package ManagerIt is a flexible and easy method to install this software. Software installed from this methoddiffers from compiling from source in a few ways, but the most important is the software isalready compiled for us. Essentially we are just doing extracting the pre-built binaries andcopying them to their pre-selected destination. RPM's are the files that have ".rpm" extension.The downside to RPM's is that we don’t have as much choice about where software isinstalled on our system, how it is compiled, and how it is configured.
Installing software with Apt-get (used by ourselves)
APT (Advance Packaging Tool) is a package management system. It consists of different
tools, which names usually begin with "apt- ”: apt-get, apt-cache, apt-cdrom, etc. apt-get
handles dependencies resolution and takes care of downloading the software for us.
Though apt-get is generally used to install binary packages, it also can build and install
source packages. One can further more ease the process of installing software by using
Synaptic.
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 7/19
apt-get depends on Debian packages repositories that can be configured in the file
/etc/apt/sources.list. A typical Debian stable sources.list would look something like this :
#Local Mirror
deb ftp://ftp.us.debian.org/debian/ stable main contrib non-freedeb-src ftp://ftp.us.debian.org/debian/ stable main contrib non-free
#Security Updatesdeb ftp://ftp.us.debian.org/debian-security/ stable/updates main contrib non-freedeb-src ftp://ftp.us.debian.org/debian-security/ stable/updates main contrib non-freeOnce the user has a sources.list adapted to his/her needs, the local list of packages needs tobe updated :
apt-get update
To search a package from its text description :
apt-cache search <something>
Replace <something> with an application name or word. For example,
apt-cache search irc client
will display a list of several irc clients.Installating a binary package is done in one single step :
apt-get install apache2
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 8/19
Installing Slackware Packages
Slackware packages are usually .tgz files containing pre-built binaries. To install software in
slackware we will need to find and download the .tgz package manually. If we are looking for
a slackware package and have not found it yet, we should search Linux packages for it.
Some Features
Start Apache 2 Server
This command will restart the apache server. It is required when we stop the server due tosome reason and want to start it again.
# /etc/init.d/apache2 start
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 9/19
Similarly apache can be restarted or stopped by using the same commands with a little bitchange in itself.
Restart Apache 2 Server
# /etc/init.d/apache2 restart
Stop Apache 2 Server
This command will stop the apache server.
# /etc/init.d/apache2 stop
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 10/19
Document Root
It is a directory (a folder) that is stored on host's servers and is designated for holding webpages. When someone else looks at your web site, this is the location they will be accessing.
Its path is /var/www
In order for a website to be accessible to visitors, it must be published to the correct directory,the "document root."
Activating the User's public_html DirectoryOn systems with multiple users, each user can have a web site in their home directoriesknown as public directory.
We have installed apache2 web server and now we activate user public directory. We create adirectory (folder) called "public_html" in our home directory,
root@asim-laptop:~# mkdir public_html
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 11/19
When we have a web server shared by many people, like a shared-hosting ISP, it is necessary
to give each user separate access to the "live" files. I have found that on a simple
development machine, it is also easier to have our work all within our own home directory
and not have to worry about permission and folders owned by the root user. What it gets you
is the ability to access your websites in your home directory by a URL in the form
http://localhost/~myhome.
There are only two commands we need to enter to activate the User Directory feature, and
then one command to restart the apache server. The last command includes an absolute path,
so it doesn't matter where we execute it from. The first two "ln" commands assume we are in
the directory /etc/apache2/mods-enabled . What we need to do is create two symbolic links
(soft links, symlinks) in the stated directory pointing to the corresponding module in
/etc/apache2/mods-available (which is where they really live). So, if "$" is your prompt,
me@myhost$ cd /etc/apache2/mods-enabled
me@myhost$ sudo ln -s ../mods-available/userdir.conf userdir.conf
me@myhost$ sudo ln -s ../mods-available/userdir.load userdir.load
me@myhost$ sudo /etc/init.d/apache2 restart
Open up a browser and type http://localhost/~asim, where "asim" is our username. Apache
should show the folders and files we have in our directory, or even display a web page if wehave an "index.html" file in there.
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 12/19
Saving files outside:Files that can be downloaded from our web site can be saved outside the public_html folder.
It is necessary in case we want to allow downloading for registered users only. In such case
we should set the access right of the files to registered users and we should save the files
outside the public_html folder, so only registered users can access it.
If we are using linux server and our path to public_html folder is e.g.:
/usr/home/ username/public_html
then our path will look like the following path:
/usr/home/username/
Domain Mapping
Def.The Domain Mapping allows user to use a custom domain name instead of the standarddomain name.Now we will map the domain of localhost.
First of all, open apache’s main configuration file, name /etc/apache2/apache2.conf . A
search for the word virtual brings us to the following line:
Include /etc/apache2/sites-enabled/[^.#]*
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 13/19
This mean that when starting apache, it will look for files in /etc/apache2/sites-enabled/ .
We go there and see what is in.
$cd /etc/apache2/sites-enabled/
$ls -l
total 1
lrwxrwxrwx 1 root root 36 2005-12-27 01:42 000-default -> /etc/apache2/sites-available/default
This only links to the file in directory /etc/apache2/sites-available/. We might wonder what
the point in doing such is. Well, this simply allows us, mainly when we are using our box as a
web server.
Now we want to to map the domain name dev.haseeb.com to our local machine, using the
code file in / home/myuser/public_html/haseeb.com / .
While in /etc/apache2/sites-available , create a new file (let say Haseeb.com.conf)
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 14/19
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 15/19
and create a link to the file we just created:
$sudo ln -s /etc/apache2/sites-available/haseeb.com.conf
Now apache is almost ready to restart, but before doing so, we must inform our linux system
that dev.haseeb.com and www.dev.haseeb.com are not to be looked for on the net, but on thelocal machine instead.
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 16/19
To do so, simply edit /etc/hosts and add the new host names at the end of the line beginning
by 127.0.0.1, which is localhost.
In the end, our file should look like:
127.0.0.1 localhost.localdomain localhost dev.haseeb.com www.dev.haseeb.com
And now we are done, simply reload apache:
sudo /etc/init.d/apache2 reload
Open our web browser and enter the following address dev.haseeb.com. It runs the same as
when we were using http://localhost
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 17/19
Creating Virtual Directory
A virtual directory offers a way to provide a consolidated view of user identity without
constructing an entire directory infrastructure.
It receives requests and directs them to the appropriate data sources. When the user data
comes back, the directory provides the data to the appropriate application as all the data had
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 18/19
8/14/2019 Apache server installation & configuration
http://slidepdf.com/reader/full/apache-server-installation-configuration 19/19
Now we have created a virtual directory named as “asim” for/home/asim/public_html/haseeb.com/test
References
http://www.linuxforums.org/forum/linux-tutorials-howtos-reference-material/64958-how-install-software-linux.htmlhttp://www.mybestratedwebhosting.com/best-web-hosting-tips/introduction-to-apache-2.htmlhttp://en.wikipedia.org/wiki/Apache2http://www.techsoup.org/learningcenter/software/page7858.cfmhttp://www.linuxforums.org/forum/linux-tutorials-howtos-reference-material/64958-how-install-software-linux.htmlhttp://forums.opensuse.org/applications/404662-how-start-stop-apache2.htmlhttp://www.cyberciti.biz/faq/ubuntu-linux-start-restart-stop-apache-web-server/ http://kimbriggs.com/computers/computer-notes/linux-notes/apache2-public_html-virtual-directories.filehttp://techgurulive.com/2009/02/21/how-to-configure-virtual-hosting-using-apache-2-on-ubuntu/ http://www.aitechsolutions.net/apacheredirect.htmlhttp://tipsntricksbd.blogspot.com/2009/06/how-to-create-virtual-directory-in.htmlhttp://ubuntuforums.org/showthread.php?t=28184
Books:
Apacheserver2bible by Mohammed j. Kabir