postfixadmin 是基于php的一个开源软件,首先要搭建php运行环境
1.开机启动nginx
server:/home/xisxy$ sudo vi /etc/rc.conf.local
nginx_flags=""
server:/home/xisxy$ sudo /etc/rc.d/nginx start
2.配置php
server:/home/xisxy$ sudo pkg_add php-5.3.21.tgz
php-5.3.21:femail-0.98: ok
php-5.3.21:femail-chroot-0.98p2: ok
php-5.3.21: ok
Look in /usr/local/share/doc/pkg-readmes for extra documentation.
--- +php-5.3.21 -------------------
To enable the php-5.3 module please create a symbolic link from
/var/www/conf/modules.sample/php-5.3.conf to
/var/www/conf/modules/php.conf. As root:
ln -sf /var/www/conf/modules.sample/php-5.3.conf /var/www/conf/modules/php.conf
The recommended php configuration has been installed to:
/etc/php-5.3.ini.
server:/home/xisxy$ sudo ln -sf /var/www/conf/modules.sample/php-5.3.conf /var/www/conf/modules/php.conf
server:/home/xisxy$ sudo pkg_add php-fpm-5.3.21.tgz
php-fpm-5.3.21: ok
The following new rcscripts were installed: /etc/rc.d/php_fpm
See rc.d(8) for details.
启动,如有新安装的php插件,应重新启动php_fpm:
server:/home/xisxy$ sudo /etc/rc.d/php_fpm start
开机启动:
server:/home/xisxy$ sudo vi /etc/rc.conf.local
pkg_scripts="php_fpm"
3.测试环境:
server:/home/xisxy$ sudo vi /var/www/htdocs/test.php
phpinfo();
?>
登录网页,配置成功就可看到php的版本等信息
http://your_ip/test.php
4.安装postfixadmin 依赖的软件包:
php-pgsql
php-imap
5.下载最新版的postfixadmin:
http://sourceforge.net/projects/postfixadmin/
server:/home/xisxy$ sudo tar zxf postfixadmin-2.3.6.tar.gz -C /var/www
server:/home/xisxy$ sudo ln -sf /var/www/postfixadmin-2.3.6 /var/www/htdocs/admin
server:/home/xisxy$ sudo vi /var/www/htdocs/admin/config.inc.php
编辑文件中的几个重要参数
$CONF['configured'] = true;
// In order to setup Postfixadmin, you MUST specify a hashed password here.
// To create the hash, visit setup.php in a browser and type a password into the field,
// on submission it will be echoed out to you as a hashed value.
$CONF['setup_password'] = '5758aea65ffb68e23f436a0a7145ebd5:45a0955baeb67f19a522f3b50b8602d9697f8581';
// Database Config
// mysql = MySQL 3.23 and 4.0, 4.1 or 5
// mysqli = MySQL 4.1+
// pgsql = PostgreSQL
$CONF['database_type'] = 'pgsql';
$CONF['database_host'] = '127.0.0.1';
$CONF['database_user'] = 'postfixdbm';
$CONF['database_password'] = 'Your passwords';
$CONF['database_name'] = 'postfixdb';
// Mail Server
// Hostname (FQDN) of your mail server.
// This is used to send email to Postfix in order to create mailboxes.
$CONF['smtp_server'] = '127.0.0.1';
$CONF['smtp_port'] = '25';
// Mailboxes
// If you want to store the mailboxes per domain set this to 'YES'.
// Examples:
// YES: /usr/local/virtual/domain.tld/[email protected]
// NO: /usr/local/virtual/[email protected]
$CONF['domain_path'] = 'YES';
// If you don't want to have the domain in your mailbox set this to 'NO'.
// Examples:
// YES: /usr/local/virtual/domain.tld/[email protected]
// NO: /usr/local/virtual/domain.tld/username
// Note: If $CONF['domain_path'] is set to NO, this setting will be forced to YES.
$CONF['domain_in_mailbox'] = 'NO';
$CONF['emailcheck_resolve_domain']='NO';
6.生成postfix认证用的数据
生成数据文件,添加管理员
http://your_ip/admin/setup.php
添加域名和用户邮箱信息
http://your_ip/admin/login.php