Defcon1-Header
Tool-BarfreeBSD ArticlesSearch Our SiteHOMEfreeBSD LinksContribute to FreeBSD HelpFreeBSD FilesFreeBSD Script Corner

Setting Up Apache as your Web Server

You first need to have the Apache Package installed on your system before we start.
  # pkg_add /cdrom/packages/www/apache-1.2.4.tgz
 
  In future versions, the name apache-1.2.4.tgz will change.  Apache with a lot of documentation in HTML format (of Course), but the port doesn't install it anywhere.  You can access the current doc's at  :
           
http://www.apache.org/manual-index.docs

Understanding Apache :
  The Apache port uses the following Directories :
* The config files are in the following directory once they have been installed
    /usr/local/etc/apache
* Web pages are in the following directory /usr/local/www/data.  You can change it by changing the entry  `DocumentRoot" in the /usr/local/etc/apache/access.conf
* All Icons are stored in. /usr/local/www.icons
* CGI scripts are stored in  /usr/local/apache/cgi-bin

Configuration of files :
  The best way to understand httpd.conf is to read through it.  Most entries can be left the way they are.  We'll look at the ones that may need to be changed, depending on your setup.
* ``ServerAdmin" is the mail ID of the system administrator.  It's set to  your@your.address, which I am sure you can see that it needs to be changed.
* You don't need to set ``ServerName", but it may be a good idea.
* The parameters ``MinSpareServers, MaxSpareServers,StartServers,MaxClients and MaxRequestperChild" are used for server tuning.  The default values should work initially, but if you have alot of Web traffic, you should consider changing them.

Virtual Hosts :
  Running and maintaining a web server is enough work that you might want to use the same server to host several sets of web pages, for example for a number of different organizations.  For example, at example.orf you may run your own web pages and also a set of pages for buguser.com.  To do this, you add the following section to  /usr/local/etc/apache/httpd.conf :
  <VirtualHost  www.biguser.com>
 ServerAdmin  greg@example.org
 DocumentRoot  /usr/local/www/biguser
 ServerName www.biguser.com
 ErrorLog  /var/log/biguser/error_log
 TransferLog  /var/log/biguser/access_log
 <VirtualHost>

  The log files don't contain any information about the names by which the data was invoked, so it's important to have separate log files for each virtual domain.  In this case we've put them in a sub directory of var/log, /var/log/biguser/  You must first create this directory before restarting the server. 
  After restarting apache, it handles any requests to  www.biguser.com  with these parameters.  If you don't define a virtual host, the server will access the main web pages (Defined by the entry ``DocumentRoot" in /usr/local/etc/apache/access.conf).

Running Apache :
  The server is stored in the rather unusual location  /usr/local/www/server/httpd.  You can run it with no parameters.
  # /usr/local/www/server/httpd

  It Automatically starts 7 other processes.

To start apache automatically at boot time, add the following entry to /etc/rc.local :
  echo -n `starting local daemons:'
 # put your local stuff here
  echo `` httpd"; /usr/local/www/server/httpd

Main Files that need to be modified :
 Under the Directory /usr/local/etc/apache  read and edit the following files, and modify them to meet your systems needs.
  1. access.conf                                   2. httpd.conf
  3. mime.types                                   4. srm.conf

Written By: GhostRdr

© 1997 - 20013 Defcon1, www.defcon1.org , Copyrights for all materials on this web site are held by the individual authors, artists, photographers or creators. Materials may not be reproduced or otherwise distributed without permission of www.defcon1.org and the content's original author.

Defcon1-Header2
Tool-Bar-2Defcon1  Webmail