Apache Part 1 - Basic Installation
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.
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!