1. Skip to Menu
  2. Skip to Content
  3. Skip to Footer>
Thursday May 2nd     6:14 PM PDT                                  

Apache Part 1 - Basic Installation

Written by Greg King Saturday, 04 July 2009 14:37

The Apache Webserver is one of the most popular applications being run under the FreeBSD operating system. Setting it up is not to complicated.  Getting it to work the way you want it to work can be a trick though as this software package is very configurable and the documentation does not always have a novice administrator in mind.

In this example, we are going to install the latest version of the apache2.2 series.  The directory structure seems to change from release to release, so some research may be necessary to completely configure the system inspite of this documentation. In our example, our freebsd system is server.ourdomain.com.  Our IP is 192.168.1.100. Our new website will be called www.ourdomain.com which we should have configured in the dns how-to.  We will not be attempting to set up vhosts, secure socket layer or html authentication yet.  Those are subjects of  later articles!
 

 Installing Apache22


# cd /usr/ports/www/apache22

# make install clean

 

Now let's instuct the system to load apache on boot up...

# echo 'apache22_enable="YES"' >> /etc/rc.conf

 


Basic configuration via httpd.conf


NOTE: in apache's configuration files, a line starting with an # indicates the line is commented out, and will not be used to configure the system.

Edit the basic configuration file with the following:

# nano /usr/local/etc/apache22/httpd.conf

 

Search (CTRL-w in nano) for: #Listen 12.34.56.78:80

edit it to read

Listen 192.168.1.100:80

 

Search for DirectoryIndex index.html

edit it to read 

DirectoryIndex index.html index.php

 

Search for: AddType application/x-gzip .gz .tgz

and add the following line immediatly after it :

AddType application/x-httpd-php .php

if you plan on sharing code, you could optionally add

AddType application/x-httpd-php-source .phps

 

Search for: # Virtual Hosts

the line after it  should read:

Include etc/apache22/extra/httpd-vhosts.conf

without an # at the beginning

 

save the file with CRTL-X 

restart apache with

# apachectl -k restart

 

That's it for the basic configuration.  Next we will look at virtual hosts, authentication and secure socket layer (SLL) set up!

  FreeBSD Configuration
eXTReMe Tracker
Content View Hits : 405006