Apache

1,026 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,026
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Apache

  1. 1. APACHE
  2. 2. SYNAPSIS <ul><li>Introduction </li></ul><ul><li>Download and extract the files </li></ul><ul><li>Configuring </li></ul><ul><li>Modules </li></ul><ul><li>Build and install </li></ul><ul><li>Customize </li></ul><ul><li>Test your server </li></ul>
  3. 3. Introduction <ul><li>Apache is the most widely used HTTP-server in the world today. </li></ul><ul><li>It surpasses all free and commercial competitors on the market, and provides a myriad of features; more than the nearest cmpetitor could give you on a UNIX variant. </li></ul><ul><li>It is also the most used web server for a Linux system. </li></ul><ul><li>A web server like Apache, in its simplest function, is software that displays and serves HTML pages hosted on a server to a client browser that understands the HTML code. </li></ul><ul><li>Mixed with third party modules and programs, it can become powerful software, which will provide strong and useful services to a client browser. </li></ul>
  4. 4. Download Extract the Files <ul><li>The best place to get Apache is from the Apache HTTP Server download site. </li></ul><ul><li>Once you've downloaded the files you need to uncompress them and untarring: </li></ul><ul><li>gunzip -d httpd-2_0_NN.tar.gz </li></ul><ul><li>tar xvf httpd-2_0_NN.tar </li></ul><ul><li>This creates a new directory under the current directory with the source files. </li></ul>
  5. 5. Configuring <ul><li>Once you've got the files, you need to tell your machine where to find everything by configuring the source files. </li></ul><ul><li>This is done using the script configure included in the root directory of the distribution. </li></ul><ul><li>To configure the source tree using all the default options, simply type ./configure. To change the default options, configure accepts a variety of variables and command line options. </li></ul><ul><li>The most important option is the location --prefix where Apache is to be installed later, because Apache has to be configured for this location to work correctly </li></ul>
  6. 6. Modules <ul><li>you can specify which features you want included in Apache by enabling and disabling modules. </li></ul><ul><li>Apache comes with a Base set of modules included by default. Other modules are enabled using the --enable-module option, </li></ul><ul><li>module is the name of the module with the mod_ string removed and with any underscore converted to a dash. </li></ul><ul><li>You can also choose to compile modules as shared objects (DSOs) -- which can be loaded or unloaded at runtime -- by using the option --enable-module=shared. </li></ul><ul><li>Similarly, you can disable Base modules with the --disable-module option. </li></ul><ul><li>Be careful when using these options, since configure cannot warn you if the module you specify does not exist; it will simply ignore the option. </li></ul>
  7. 7. ...continued <ul><li>You can also set specific environment variables and modules. Some of the modules are: </li></ul><ul><li>* mod_alias - to map different parts of the URL tree </li></ul><ul><li>* mod_include - to parse Server Side Includes </li></ul><ul><li>* mod_mime - to associate file extensions with its MIME-type </li></ul><ul><li>* mod_rewrite - to rewrite URLs on the fly </li></ul><ul><li>* mod_speling (sic) - to help your readers who might misspell URLs </li></ul><ul><li>* mod_ssl - to allow for strong cryptography using SSL </li></ul><ul><li>* mod_userdir - to allow system users to have their own Web page directories </li></ul>
  8. 8. <ul><li>It is sometimes necessary to provide the configure script with extra information about the location of your compiler, libraries, or header files. </li></ul><ul><li>This is done by passing either environment variables or command line options to configure. </li></ul><ul><li>For a short impression of what possibilities you have, here is a typical example which compiles Apache for the installation tree /sw/pkg/apache with a particular compiler and flags plus the two additional modules mod_rewrite and mod_speling for later loading through the DSO mechanism: </li></ul><ul><li>$ CC=&quot;pgcc&quot; CFLAGS=&quot;-O2&quot; </li></ul><ul><li>./configure --prefix=/sw/pkg/apache </li></ul><ul><li>--enable-rewrite=shared </li></ul><ul><li>--enable-speling=shared </li></ul>
  9. 9. Build and install <ul><li>Now you can build the various parts which form the Apache package by simply running the command: </li></ul><ul><li>$ make </li></ul><ul><li>Now it's time to install the package under the configured installation PREFIX (see --prefix option above) by running: </li></ul><ul><li>$ make install </li></ul>
  10. 10. customize <ul><li>Next, you can customize your Apache HTTP server by editing the configuration files under PREFIX/conf/. </li></ul><ul><li>$ vi PREFIX/conf/httpd.conf </li></ul><ul><li>Note: you'll need to be root to edit this file. </li></ul>
  11. 11. Test Your Server <ul><li>Now you can start your Apache HTTP server by immediately running: </li></ul><ul><li>$ PREFIX/bin/apachectl start </li></ul><ul><li>And then you should be able to request your first document via URL http://localhost/. </li></ul><ul><li>The web page you see is located under the DocumentRoot which will usually be PREFIX/htdocs/. Then stop the server again by running: </li></ul><ul><li>$ PREFIX/bin/apachectl stop </li></ul><ul><li>Specifically, it will say in big letters &quot;Seeing this instead of the website you expected?&quot; This is good news, as it means your server installed correctly. </li></ul>
  12. 12. Uninstall apache <ul><li>OPTION 1: Run this command if you installed apache with RPM or throug the automatic option during the Fedora/Red Hat OS installation. </li></ul><ul><li>Code : yum remove httpd </li></ul><ul><li>OPTION 2: Run </li></ul><ul><li>Code: /etc/init.d/httpd stop to get the package name. </li></ul><ul><li>It should come back with something like this: </li></ul><ul><li>Code: apachecfg-0.3.1-6 </li></ul><ul><li>apache-1.2.5-1 </li></ul><ul><li>You can then use this command to remove Apache: </li></ul><ul><li>Code: rpm -e apache-1.2.5-1 </li></ul>
  13. 13. <ul><li>OPTION 3. </li></ul><ul><li>If you compiled apache on your own. If you did a manual install then just delete /usr/local/apache (or wherever it is installed). </li></ul><ul><li>OPTION 4. </li></ul><ul><li>if you are doing it manually then to remove Apache from your Linux server, enter this line at the Linux command prompt: </li></ul><ul><li>Code: rm -rf /usr/local/apache2 </li></ul><ul><li>OPTION 5: </li></ul><ul><li>To find files by name try &quot;locate&quot;; it will force you to run updatedb the first time. </li></ul><ul><li>To find packages that are installed try rpm -qa *apache* *mysql* </li></ul><ul><li>{ note &quot;rpm -qa&quot; lists all installed packages } </li></ul>

×