We'll walk through the installation for Apache2. It's very simple to install - in earlier versions of Apache, you had to install either mods or different versions depending on whether you wanted to enable certain features (ssl, etc). With Apache2, they are incorporated into the main package, and enabled or disabled when you configure Apache. There are a few exceptions, but most everything you'll need to run a modern feature-rich webserver is included with the Apache2 port.
Note: As always, before installing any ports, update your ports tree with csup if it has been a while.
Let's get started:
>su Password: (enter root password) oyabun# cd /usr/ports/www oyabun# ls | grep apache apache-contrib apache-forrest apache-jserv apache13 apache13+ipv6 apache13-fp apache13-modperl apache13-modssl apache13-modssl+ipv6 apache13-ssl apache20 mod_jk-apache2 mod_jk2-apache2 oyabun# cd apache20 oyabun# make install clean
First, I changed to the superuser, as we'll be installing software. I changed directory to the www section of the ports tree, and filtered a listing of that directories contents for all ports that contained the word 'apache' using grep. The one we want is apache2. I then changed to that directory, and issued the make command, with options install and clean specified, to install the software and clean up the makefiles when done.
Note that you'll want to check the file /usr/ports/www/apache2/Makefile.doc to see what modules you can build into apache2 -- e.g., LDAP or IPv6 or threading. To include the one you want, you'd want to build apache like so:
samizdata# make -DWITH_LDAP_MODULE install clean
After a few seconds, minutes, or hours (depending on whether your hardware is going to waste, reasonable, or a throwback to the early 90's), Apache2's installation will be completed, and you'll be faced with this note:
Available variables you add/set to /etc/rc.conf. - apache2_enable (bool): Set to "NO" by default. Set it to "YES" to enable apache2. - apache2ssl_enable (bool): Set to "NO" by default. Set it to "YES" to start apache with SSL (if <IfDefined SSL> exists in httpd.conf). - apache2limits_enable (bool):Set to "NO" by default. Set it to yes to run `limits $limits_args` just before apache starts. - apache2_flags (str): Set to "" by default. Extra flags passed to start command. - apache2limits_args (str): Default to "-e -C daemon" Arguments of pre-start limits run.
As you can see from this, ssl suport is included in Apache2, as opposed to Apache 1.3. I included this output because I have a bad habit of scrolling important stuff like this out of the buffer after installations, and it's nice to have it saved here. You don't need to worry about any of this until you configure Apache.
So, Apache2 is now installed, you just need to actually set it up.
Please visit Apache Controlling to learn how to actually start your webserver.