This is an old revision of the document!
FreeBSD Apache
Install
First, add your hostname to /etc/hosts
so Apache doesn't have issues with local name resolution.
Build and install Apache using ports.
cd /usr/ports/www/apache22-worker-mpm make -DWITHOUT_DAV -DWITHOUT_DAV_FS -DWITHOUT_CGI -DWITH_SUEXEC make install cd /usr/ports/www/mod_fcgid && make install
Add user for suexec
pw useradd -n vhost -s /usr/sbin/nologin -d /nonexistent
Modify Apache configuration
Load fcgid module
fetch -q -o /usr/local/etc/apache22/extra/httpd-fcgid.conf http://freebsd.digitaltrike.com/apache/httpd-fcgid.conf echo "# Digital Trike" >> /usr/local/etc/apache22/httpd.conf echo Include etc/apache22/extra/httpd-fcgid.conf >> /usr/local/etc/apache22/httpd.conf
LoadModule fcgid_module libexec/apache22/mod_fcgid.so <IfModule mod_fcgid.c> AddHandler fcgid-script .fcgi </IfModule>
Create filesystem hierarchy
cd /usr/local/www/localhost/ mkdir cgi-bin htdocs sessions uploads chown www:www sessions uploads chown dtrike:dtrike htdocs cd cgi-bin wget http://freebsd.digitaltrike.com/php/php-cgi.ini -O /usr/local/etc/php-cgi.ini wget http://freebsd.digitaltrike.com/php/php-wrapper -O /usr/local/www/localhost/cgi-bin/php-wrapper chmod +x /usr/local/www/localhost/cgi-bin/php-wrapper
Include etc/apache22/extra/httpd-mpm.conf Include etc/apache22/extra/httpd-info.conf Include etc/apache22/extra/httpd-vhosts.conf Include etc/apache22/extra/httpd-default.conf Include etc/apache22/extra/httpd-ssl.conf
Create virtual host configuration
mkdir -p /var/www/localhost/{htdocs,cgi-bin,sessions,uploads,php} wget -q http://freebsd.digitaltrike.com/php-wrapper -O /var/www/localhost/cgi-bin/php-wrapper chmod +x /var/www/localhost/cgi-bin/php-wrapper chown -R vhost:vhost /var/www/localhost/{cgi-bin,htdocs} touch /var/www/localhost/php/error_log chown www:www /var/www/localhost/{sessions,uploads,php/error_log} wget -q http://freebsd.digitaltrike.com/deployment/fs-overlay/var/www/localhost/php.ini -O /var/www/localhost/php/php.ini
Setup Apache to start on boot
Load the accf_http
module:
kldload accf_http
Add to /etc/rc.conf
:
accf_http_load="YES" apache22_enable="YES"