首页 > 代码库 > Mail服务器架设
Mail服务器架设
workstation(192.168.1.105):
yum -y install postfix //centos系统已经默认安装了
vim /etc/postfix/main.cf //配置SMTP
75 myhostname = workstation.example.com
83 mydomain = example.com
99 myorigin = $mydomain
116 inet_interfaces = all
164 mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain
264 mynetworks = 192.168.1.0/24, 127.0.0.0/8
419 home_mailbox = Maildir/
574 smtpd_banner = $myhostname ESMTP
在最后添加:
680 message_size_limit = 10485760
681 mailbox_size_limit = 1073741824
682 smtpd_sasl_type = dovecot
683 smtpd_sasl_path = private/auth
684 smtpd_sasl_auth_enable = yes
685 smtpd_sasl_security_options = noanonymous
686 smtpd_sasl_local_domain = $myhostname
687 smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
systemctl restart postfix
systemctl enable postfix
yum -y install dovecot //安装DOVECOT来配置pop/imap
vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
listen = *
vim /etc/dovecot/conf.d/10-auth.conf
10 disable_plaintext_auth = no
100 auth_mechanisms = plain login
vim /etc/dovecot/conf.d/10-mail.conf
30 mail_location = maildir:~/Maildir
97 mode = 0666
98 user = postfix
99 group = postfix
100 }
vim /etc/dovecot/conf.d/10-ssl.conf
ssl = no //不使用ssl登录
systemctl restart dovecot;systemctl enable dovecot
给http服务器安装php
yum -y install php php-mbstring php-pear
vim /etc/php.ini
878 ;date.timezone = "Asia/Shanghai" //配置时区
systemctl restart httpd
配置ssl
创建密钥
cd /etc/pki/tls/certs/
make server.key
openssl rsa -in server.key -out server.key //生成ssl密钥
make server.csr
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
配置ssl
yum -y install mod_ssl
vim /etc/httpd/conf.d/ssl.conf
59 DocumentRoot "/var/www/html"
60 ServerName workstation.example.com:443//修改为自己的主机名
100 SSLCertificateFile /etc/pki/tls/certs/server.crt//修改为自己第一步创建的证书
107 SSLCertificateKeyFile /etc/pki/tls/certs/server.key//修改为第一步创建的密钥
systemctl restart httpd //重启服务
安装和配置squirrelmail
yum -y install squirrelmail
在http://www.squirrelmail.org/plugins/分别下载如下三个包并解压缩到/usr/share/squirrelmail/plugins/下
empty_trash-2.0-1.2.2.tar.gz
compatibility-2.0.16-1.0.tar.gz
secure_login-1.4-1.2.8.tar.gz
/usr/share/squirrelmail/config/conf.pl//运行配置脚本
具体设置见附件
cp /usr/share/squirrelmail/plugins/secure_login/config.sample.php /usr/share/squirrelmail/plugins/secure_login/config.php
vim /usr/share/squirrelmail/plugins/secure_login/config.php
systemctl restart httpd
登陆网页验证:分别输入自己系统当中两个用户,互相发邮件
本文出自 “12146768” 博客,请务必保留此出处http://12156768.blog.51cto.com/12146768/1862146
Mail服务器架设