<< Back to man.ChinaUnix.net

5. Installing Apache

You can install Apache 2 or 1.3, both work equally well. I have chosen to install Apache 2.

cd /usr/ports/www/apache2
make
make install
make clean

Edit ServerName, use an IP if not using a real (DNS listed, or FQDN) domain name.

ee /usr/local/etc/apache2/httpd.conf

Some users might have to comment out the following line referencing "mod_unique_id" if Apache won't load (check your logs). More info coming!

monitor# /usr/local/sbin/apachectl start
/usr/local/sbin/apachectl start: httpd started

monitor# ps -aux | grep httpd
root   8368  0.0  0.2  2500  2100  ??  Ss   12:37PM   0:00.02 /usr/local/sbin/httpd
www    8369  0.0  0.2  2884  2320  ??  I    12:37PM   0:00.00 /usr/local/sbin/httpd
www    8370  0.0  0.2  2512  2124  ??  I    12:37PM   0:00.00 /usr/local/sbin/httpd
www    8371  0.0  0.2  2512  2124  ??  I    12:37PM   0:00.00 /usr/local/sbin/httpd
www    8372  0.0  0.2  2512  2124  ??  I    12:37PM   0:00.00 /usr/local/sbin/httpd
www    8373  0.0  0.2  2512  2124  ??  I    12:37PM   0:00.00 /usr/local/sbin/httpd
www    8374  0.0  0.2  2512  2124  ??  I    12:37PM   0:00.00 /usr/local/sbin/httpd

Good, it's running. Now you must add Apache to rc.conf so it's starts at boot time.

ee /etc/rc.conf

Then add:

apache2_enable="YES"

Visit the IP address of your server (i.e. http://192.168.1.10 or whatever IP you used) , you should be greeted with the default Apache welcome page as shown below.