- cd /usr/ports/www/apache22
- make config
- make install
Then, add the lines:
In the file:
- vi /etc/rc.conf
And then, run the service:
- /usr/local/etc/rc.d/apache22 start
Verify if the server is running:
- netstat -tan
And check if port 80 is open, then #telnet localdomain 80
When you want to install any package, just go to the port directory and install it. In this case is under www directory, /usr/ports/www/apache13-modperl. It will download from ftp.freebsd.org and start make. The progress took a while since the connection in Seneca is slow. When I install at home it took about 30 minutes to finish 'make' in my VM. And I waited about 3 hours for the make at seneca and it never finished.
I personally prefer yum and apt-get instead of FreeBSD "port" method. Because they have a great search function that let you search by keyword. Of course you can do the simulatr thing in FreeBSD with some ls command. It's just much more easier in Linux.
# vim /usr/local/etc/apache22/httpd.conf
replace the line "ServerAdmin" email@example.com" with the systems administrators e-mail address.
replace "ServerName host.example.com:80" line with hostname of your server accordingly
# echo "apache22_enable="YES" >> /etc/rc.conf
# echo "apache22_http_accept_enable="YES" >> /etc/rc.conf
# apachectl configtest
# /usr/local/etc/rc.d/apache22 start
Upon first attempting to install Apache, I chose Apache 2.2. This worked fine, and the installation of itself went alright - problems only occured when I attempted to build mod_python. It appears the version of mod_python included in the ports collection expects Apache 1.3. So, I went back, removed 2.2, and installed 2.1
After this, the next hurdle was that mod_python expects a single-threaded Python runtime, however, the default in FreeBSD is a threaded runtime. So, it was necessary to deinstall the Python 2.5 port, set the WITHOUT_THREADS environment variable to 1, and rebuild/reinstall Python, after which mod_python will happily build and install.
mod_perl, on the otherhand, was a relatively smooth install, and required nothing beyond just the standard 'make install distclean'. All it's dependencies were present and in a working state by default.
After the software is installed, it is necessary to set the server's name, both by adding the line 'ServerName "fbsd"' to the Apache configuration file at /usr/local/etc/apache/httpd.conf, as well as the line '127.0.0.1 fbsd' into /etc/hosts. After this, the Apache server starts succesfully.
The final hurdle was correcting the provided CGI scripts to behave properly in the CGI environment. It was neccesary to add the line: 'print "Content-Type: text/html\n\n";' to the Perl script and the line 'print "Content-Type: text/html\n"' to the Python script. After these changes, both scripts ran as expected, producing correct output.
It would be nice to have a version of mod_python in ports that works properly with Apache 2.2.