With standart Makefie you can automate installing services. For example, install apache24+php56.

# vi Makefile

 

apache: pkg ins -y apache24 php56 mod_php56 php56-extensions sed -i -e 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/' /usr/local/etc/apache24/httpd.conf echo 'ServerName 127.0.0.1:80' >> /usr/local/etc/apache24/httpd.conf echo '<FilesMatch "\.php$">' >> /usr/local/etc/apache24/httpd.conf echo 'SetHandler application/x-httpd-php' >> /usr/local/etc/apache24/httpd.conf echo '</FilesMatch>' >> /usr/local/etc/apache24/httpd.conf echo '<FilesMatch "\.phps$">' >> /usr/local/etc/apache24/httpd.conf echo 'SetHandler application/x-httpd-php-source' >> /usr/local/etc/apache24/httpd.conf echo '</FilesMatch>' >> /usr/local/etc/apache24/httpd.conf echo 'apache24_enable="YES"' >> /etc/rc.conf service apache24 start apache_del: service apache24 stop pkg del -y apache24 php56 mod_php56 php56-extensions pkg autoremove -y rm -rf /usr/local/etc/apache24

 

Now, you can install or deistall web server.

# make apache # make apache_del