Build a Dynamic Web and Email Serving Platform
Created: 02/11/2006
Edit this guide
General Information
Using FreeBSD, Apache-modSSL, MySQL, PHP, Sendmail and CuCiPop, you can setup an open source solution that will have you serving dynamic web pages and email quickly, reliably, securely, and efficiently without any out-of-pocket expense.Install CVsup to Stay Current
If you have just installed the ports collection using a CD-ROM, you must upgrade to the latest releases of the ported software you need.|
# # # # |
cd /usr/ports/net/cvsup-without-gui make make install make clean |
/usr/share/examples/cvsup/ports-supfile to a new location. In this case, copy to /root on your home directory:| # | cp /usr/share/examples/cvsup/ports-supfile /root/ports-supfile |
| # | ee /root/ports-supfile |
|
*default host=cvsup.au.FreeBSD.org. *default base=/usr *default prefix=/usr *default release=cvs *default delete use-rel-suffix *default tag=. src-all |
| # | cvsup -g -L 2 /root/ports-supfile |
Install Perl5
Enter the following commands one at a time, waiting for the command prompt between each command.|
# # # # # # # # |
cd /usr/ports/lang/perl5 make make test make install make clean cd ~ rehash use.perl port |
Install MySQL
|
# # # # # |
cd /usr/ports/databases/mysql40-server make make install make clean ee /etc/make.conf |
|
WITH_BDB_VER=40 WITH_MYSQL_VER=40 |
Install Apache-mod_ssl
|
# # # |
cd /usr/ports/www/apache13-modssl make make certificate TYPE=custom |
|
# # # |
make install make clean ee /etc/rc.conf |
|
apache_enable="YES" |
| # | ee /usr/local/etc/apache/httpd.conf |
| # | ee /etc/hosts |
|
192.168.1.254 webserver www.mydomain.com |
Install PHP
|
# # |
cd /usr/ports/www/mod_php4 make |
|
# # |
make install make clean |
Install PHP Extensions
|
# # |
cd /usr/ports/lang/php4-extensions make install distclean |
|
# # |
cd ~ ee /usr/local/etc/apache/httpd.conf |
|
AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .php3s AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps |
|
# # |
apachectl stop apachectl startssl |
|
# # |
cd ~ ee /usr/local/www/data/index.php |
|
<html> <body> <?php phpinfo(); ?> </body> </html> |
Start and Configure MySQL
| # | ee /etc/rc.conf |
|
mysql_enable="¯YES"¯ |
|
# # |
sh /usr/local/etc/rc.d/mysql-server.sh start mysql -u root -p |
|
DELETE FROM mysql.user WHERE User = ''; FLUSH PRIVILEGES; |
|
UPDATE mysql.user SET Password = PASSWORD('newpwd') WHERE User = 'root'; FLUSH PRIVILEGES; |
|
GRANT ALL PRIVILEGES ON *.* TO 'root'@'< <remote ip address> >' IDENTIFIED BY '< <password> >' WITH GRANT OPTION; |
|
quit; |
Test MySQL and PHP (Optional)
| # | ee /usr/local/www/data/mysql.php |
|
<html <body <?php $Server = "localhost"; $Username = "root"; $Pass = "<<password>>"; $Connection = mysql_connect ($Server, $Username, $Pass); if ($Connection) echo ("Connected”); else echo ("Not Connected"); mysql_close ($Connection); ?> </body> </html> |
Install and Configure Sendmail
|
# # # # # # # |
cd /usr/ports/mail/sendmail make make install make clean cd /usr/mail/ cp access.sample access ee aliases |
|
192.168 RELAY YOURDOMAIN RELAY |
| # | ee local-host-names |
|
mail.YOURDOMAIN YOURDOMAIN YOURIPADDRESS |
Install and Configure CuCiPop
|
# # # # # |
cd /usr/ports/mail/cucipop make make install make clean ee /urs/local/etc/rc.d/cucipop.sh |
|
#!/bin/sh [ -x /usr/local/libexec/cucipop ] && /usr/local/libexec/cucipop -Y && echo "CuCiPop started" |
|
# # |
chmod 750 /usr/local/etc/rc.d/cucipop.sh killall -hup inetd |
| # | shutdown -r now |
|
# # # |
apachectl startssl sh /usr/local/etc/rc.d/mysql-server.sh start sh /usr/local/etc/rc.d/cucipop.sh |