centos7搭建smtp服務(wù)器

環(huán)境

[root@CentOS7 ~]# uname -a

Linux CentOS7 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

下列配置均在配置文件指定處修改

配置系統(tǒng)相關(guān)

關(guān)閉selinux

setenforce 0

關(guān)閉firewalld防火墻靶瘸,并清空iptables規(guī)則:

systemctl stop firewalld

iptables -F

iptables -X

iptables -nvL

安裝mysql

yum install -y wget

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -ivh epel-release-latest-7.noarch.rpm

安裝必要的庫

yum install nginx vim gcc gcc-c++ openssl openssl-devel db4-devel ntpdate mysql mysql-devel mysql-server bzip2 php-mysql cyrus-sasl-md5 perl-GD perl-DBD-MySQL perl-GD perl-CPAN perl-CGI perl-CGI-Session cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl cyrus-sasl-devel libtool-ltdl-devel telnet mail libicu-devel -y

配置用戶

yum remove postfix -y

userdel postfix

groupdel postdrop

groupadd -g 2525 postfixuseradd -g postfix -u 2525-s/sbin/nologin -M postfix

groupadd -g 2526 postdropuseradd -g postdrop -u 2526-s/sbin/nologin -M postdrop

cd/usr/local/src/

安裝postfix并配置

wget http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/postfix-3.0.11.tar.gztar -zxvf postfix-3.0.11.tar.gzcdpostfix-3.0.11

make makefiles'CCARGS=-DHAS_MYSQL -I/usr/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS ''AUXLIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lrt -lm -L/usr/lib64/sasl2 -lsasl2 -lssl -lcrypto'

make && make install

tempdir: [/usr/local/src/postfix-3.0.11] /tmp/extmail // 就只更改這一項為tmp目錄粪牲,其他的全部默認(rèn)

更改目錄的屬主和屬組

[root@CentOS7 postfix-3.0.11]# chown -R postfix:postdrop /var/spool/postfix

[root@CentOS7 postfix-3.0.11]# chown -R postfix:postdrop /var/lib/postfix/

[root@CentOS7 postfix-3.0.11]# chown root /var/spool/postfix

[root@CentOS7 postfix-3.0.11]# chown -R root /var/spool/postfix/pid

[root@CentOS7 ~]# chmod a+x /etc/postfix

[root@CentOS7 ~]# vim postfix

#!/bin/bash

#

# postfix? ? ? Postfix Mail Transfer Agent

#

# chkconfig: 2345 80 30

# description: Postfix is a Mail Transport Agent, which is the program \

#? ? ? ? ? ? ? that moves mail from one machine to another.

# processname: master

# pidfile: /var/spool/postfix/pid/master.pid

# config: /etc/postfix/main.cf

# config: /etc/postfix/master.cf

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ $NETWORKING = "no" ] && exit 3

[ -x /usr/sbin/postfix ] || exit 4

[ -d /etc/postfix ] || exit 5

[ -d /var/spool/postfix ] || exit 6

RETVAL=0

prog="postfix"

start() {

? ? # Start daemons.

? ? echo -n $"Starting postfix: "

? ? ? ? /usr/bin/newaliases >/dev/null 2>&1

? ? /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start"

? ? RETVAL=$?

? ? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix

? ? ? ? echo

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/postfix

? ? ? ? echo

? ? return $RETVAL

}

stop() {

? # Stop daemons.

? ? echo -n $"Shutting down postfix: "

? ? /usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop"

? ? RETVAL=$?

? ? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/postfix

? ? echo

? ? return $RETVAL

}

reload() {

? ? echo -n $"Reloading postfix: "

? ? /usr/sbin/postfix reload 2>/dev/null 1>&2 && success || failure $"$prog reload"

? ? RETVAL=$?

? ? echo

? ? return $RETVAL

}

abort() {

? ? /usr/sbin/postfix abort 2>/dev/null 1>&2 && success || failure $"$prog abort"

? ? return $?

}

flush() {

? ? /usr/sbin/postfix flush 2>/dev/null 1>&2 && success || failure $"$prog flush"

? ? return $?

}

check() {

? ? /usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check"

? ? return $?

/usr/sbin/postfix check 2>/dev/null 1>&2 && success || failure $"$prog check"

? ? return $?

}

restart() {

? ? stop

? ? start

}

# See how we were called.

case "$1" in

? start)

? ? start

? ? ;;

? stop)

? ? stop

? ? ;;

? restart)

? ? stop

? ? start

? ? ;;

? reload)

? ? reload

? ? ;;

? abort)

? ? abort

? ? ;;

? flush)

? ? flush

? ? ;;

? check)

? ? check

? ? ;;

? status)

? ? ? status master

? ? ;;

condrestart)

? ? [ -f /var/lock/subsys/postfix ] && restart || :

? ? ;;

? *)

? ? echo $"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"

? ? exit 1

esac

exit $?

為腳本添加執(zhí)行權(quán)限津畸,并將服務(wù)添加到開機(jī)啟動項中

[root@CentOS7 ~]# chkconfig --add postfix

[root@CentOS7 ~]# chkconfig postfix on

[root@CentOS7 ~]# chown postfix.postfix -R /var/lib/postfix/

[root@CentOS7 ~]# chown postfix.postfix /var/spool/ -R

安裝dovecot

yum install -y dovecot dovecot-mysql

配置dovecot

[root@localhost ~]# cd /etc/dovecot/

[root@localhost dovecot]# vim dovecot.conf? ? //直接在配置文件最后添加即可

protocols = imap pop3

!include conf.d/*.conf

listen = *

base_dir = /var/run/dovecot/

[root@localhost dovecot]# cd conf.d/

[root@localhost conf.d]# vim 10-auth.conf

disable_plaintext_auth = no

[root@localhost conf.d]# vim 10-mail.conf

mail_location = maildir:~/Maildir

mail_location = maildir:/var/mailbox/%d/%n/Maildir

mail_privileged_group = mail

[root@localhost conf.d]# vim 10-ssl.conf

ssl = no

[root@localhost conf.d]# vim 10-logging.conf

log_path = /var/log/dovecot.log

info_log_path = /var/log/dovecot.info

log_timestamp = "%Y-%m-%d %H:%M:%S "

[root@localhost conf.d]# cp auth-sql.conf.ext auth-sql.conf

[root@localhost conf.d]# vim auth-sql.conf

passdb {?

? ? driver = sql? ? ? ?

? ? # Path for SQL configuration file, see example-config/dovecot-sql.conf.ext?

? ? args = /etc/dovecot/dovecot-sql.conf.ext

}

userdb {?

? ? driver = sql?

? ? args = /etc/dovecot/dovecot-sql.conf.ext

}

安裝 Courier Unicode Library

wget https://sourceforge.net/projects/courier/files/courier-unicode/1.2/courier-unicode-1.2.tar.bz2

tar jxvf courier-unicode-1.2.tar.bz2

cd courier-unicode-1.2

./configure && make && make install

安裝courier-authlib

cd /usr/local/src/

?wget https://sourceforge.net/projects/courier/files/authlib/0.66.2/courier-authlib-0.66.2.tar.bz2

tar -jxvf courier-authlib-0.66.2.tar.bz2

cd courier-authlib-0.66.2

./configure --prefix=/usr/local/courier-authlib --sysconfdir=/etc --without-authpam --without-authshadow --without-authvchkpw --without-authpgsql --with-authmysql --with-mysql-libs=/usr/lib64/mysql --with-mysql-includes=/usr/include/mysql --with-redhat --with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc --with-mailuser=postfix

make && make install

配置courier-authlib

chmod 755 /usr/local/courier-authlib/var/spool/authdaemon

cp /etc/authdaemonrc.dist /etc/authdaemonrc

cp /etc/authmysqlrc.dist /etc/authmysqlrc

vim /etc/authdaemonrc //配置文件里的驗證方法比較多重父,我們這里只使用authmysql

authmodulelist="authmysql"

authmodulelistorig="authmysql"

vim /etc/authmysqlrc //直接添加到配置文件尾部巍膘,然后去上面將響應(yīng)系統(tǒng)默認(rèn)的注視掉泞歉,或者刪除即可

MYSQL_SERVER localhost

MYSQL_USERNAME? ? ? ? ? extmail

MYSQL_PASSWORD? ? ? ? ? extmail

MYSQL_SOCKET? ? ? ? ? ? /var/lib/mysql/mysql.sock

MYSQL_PORT? ? ? ? ? ? ? 3306

MYSQL_DATABASE? ? ? ? ? extmail

MYSQL_USER_TABLE? ? ? ? mailbox

MYSQL_CRYPT_PWFIELD? ? password

DEFAULT_DOMAIN? ? ? ? ? test.com

MYSQL_UID_FIELD? ? ? ? '2525'

MYSQL_GID_FIELD? ? ? ? '2525'

MYSQL_LOGIN_FIELD? ? ? username

MYSQL_HOME_FIELD? ? ? ? concat('/var/mailbox/',homedir)

MYSQL_NAME_FIELD? ? ? ? name

MYSQL_MAILDIR_FIELD? ? concat('/var/mailbox/',maildir)

courier-authlib添加服務(wù)啟動腳本及其他

[root@CentOS7 courier-authlib-0.66.2]# cp courier-authlib.sysvinit /etc/init.d/courier-authlib

[root@CentOS7 courier-authlib-0.66.2]# chmod +x /etc/init.d/courier-authlib

[root@CentOS7 courier-authlib-0.66.2]#? chkconfig --add courier-authlib

[root@CentOS7 courier-authlib-0.66.2]# chkconfig courier-authlib on

[root@CentOS7 courier-authlib-0.66.2]# echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf.d/courier-authlib.conf

[root@CentOS7 courier-authlib-0.66.2]#? ldconfig

[root@CentOS7 courier-authlib-0.66.2]# service courier-authlib start

Starting Courier authentication services: authdaemond

[root@CentOS7 courier-authlib-0.66.2]#

smtp以及虛擬用戶相關(guān)的設(shè)置

[root@CentOS7 courier-authlib-0.66.2]# vim /usr/lib64/sasl2/smtpd.conf //文件不存在割坠,要自己創(chuàng)建

pwcheck_method: authdaemond

log_level: 3

mech_list: PLAIN LOGIN

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

安裝extmail

安裝extmail和extman

下載extmail和extman

https://zh.osdn.net/projects/sfnet_ds5752/downloads/yu/extmail-1.2.tar.gz/

https://zh.osdn.net/projects/sfnet_ds5752/downloads/yu/extman-1.1.tar.gz/

創(chuàng)建站點(diǎn)目錄并解壓功茴、重命名extmail包

[root@CentOS7 src]# mkdir -p /var/www/extsuite

[root@CentOS7 src]# tar -zxvf extmail-1.2.tar.gz -C /var/www/extsuite/

[root@CentOS7 src]# mv /var/www/extsuite/extmail-1.2/ /var/www/extsuite/extmail

建立臨時文件目錄與session目錄礁凡,并更改權(quán)限

[root@CentOS7 extmail]# mkdir -p /tmp/extmail/upload

[root@CentOS7 extmail]# chown -R postfix.postfix /tmp/extmail/

回到extman的下載目錄下高氮,解壓extman包

cd /usr/local/src/

tar -zxvf extman-1.1.tar.gz -C /var/www/extsuite/

cd /var/www/extsuite/

mv extman-1.1/ extman

拷貝extman的配置文件

[root@CentOS7 extsuite]# cd extman/

[root@CentOS7 extman]# cp webman.cf.default webman.cf

更改cgi目錄的屬主屬組

[root@CentOS7 extman]# chown -R postfix.postfix /var/www/extsuite/extman/cgi/

[root@CentOS7 extman]# chown -R postfix.postfix /var/www/extsuite/extmail/cgi/

配置數(shù)據(jù)庫

導(dǎo)入數(shù)據(jù)庫

[root@CentOS7 extman]# vim docs/extmail.sql

:%s/TYPE/ENGINE/

[root@CentOS7 extman]# mysql -uroot < docs/extmail.sql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

[root@CentOS7 extman]#

[root@CentOS7 extman]# yum install mysql-server mysql-client -y

[root@CentOS7 extman]# service mysqld restart

[root@CentOS7 extman]# mysql -uroot < docs/extmail.sql

ERROR 1364 (HY000) at line 31: Field 'ssl_cipher' doesn't have a default value

[root@CentOS7 extman]# vim /etc/my.cnf? //把sql_mode參數(shù)注釋掉

#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[root@CentOS7 extman]# mysql -uroot < docs/extmail.sql

[root@CentOS7 extman]# mysql -uroot < docs/init.sql

導(dǎo)入數(shù)據(jù)成功后再次修改/etc/my.cnf文件,把剛剛注釋的那行給去掉注釋顷牌,不去掉的話剪芍,mysql服務(wù)可能會出現(xiàn)不能啟動的問題:

[root@CentOS7 extman]# vim /etc/my.cnf

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

登陸mysql

[root@CentOS7 extman]# mysql -u root

mysql> GRANT ALL ON extmail.* to extmail@'%' identified by 'extmail';

Query OK, 0 rows affected (0.00 sec)

復(fù)制之前的配置文件

[root@CentOS7 extman]# cd /var/www/extsuite/extman/docs/

[root@CentOS7 docs]# cp mysql_virtual_* /etc/postfix/

為extman創(chuàng)建臨時目錄

[root@CentOS7 docs]# mkdir /tmp/extman

[root@CentOS7 docs]#? chown -R postfix.postfix /tmp/extman/

啟動postfix、dovecot窟蓝、saslauthd服務(wù)罪裹,并查看進(jìn)程是否正常

[root@CentOS7 docs]# service postfix start

Starting postfix (via systemctl):? ? ? ? ? ? ? ? ? ? ? ? ? [? OK? ]

[root@CentOS7 docs]#

[root@CentOS7 docs]# ps -aux|grep postfix

root? ? ? 7277? 0.0? 0.0? 95432? 2144 ?? ? ? ? Ss? 10:19? 0:00 /usr/libexec/postfix/master -w

postfix? 7278? 0.0? 0.0? 95492? 3804 ?? ? ? ? S? ? 10:19? 0:00 pickup -l -t unix -u

postfix? 7279? 0.0? 0.0? 95540? 3828 ?? ? ? ? S? ? 10:19? 0:00 qmgr -l -t unix -u

root? ? ? 7322? 0.0? 0.0 112708? 968 pts/0? ? S+? 10:20? 0:00 grep --color=auto postfix

[root@CentOS7 docs]#

[root@CentOS7 docs]# ss -tnluo | grep :25

tcp? ? LISTEN? ? 0? ? ? 100? ? ? *:25? ? ? ? ? ? ? ? ? ? *:*? ? ? ? ? ? ? ? ?

[root@CentOS7 docs]# netstat -nap|grep 25

tcp? ? ? ? 0? ? ? 0 0.0.0.0:25? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 7277/master? ? ? ?

unix? 2? ? ? [ ACC ]? ? STREAM? ? LISTENING? ? 176525? 7277/master? ? ? ? ? private/virtual

[root@CentOS7 docs]# service dovecot start

Redirecting to /bin/systemctl start dovecot.service

[root@CentOS7 docs]# ps -aux|grep dovecot

root? ? ? 7440? 0.2? 0.0? 42428? 1972 ?? ? ? ? Ss? 10:22? 0:00 /usr/sbin/dovecot -F

dovecot? 7442? 0.0? 0.0? 9360? 1012 ?? ? ? ? S? ? 10:22? 0:00 dovecot/anvil

root? ? ? 7443? 0.0? 0.0? 9488? 1168 ?? ? ? ? S? ? 10:22? 0:00 dovecot/log

root? ? ? 7445? 0.0? 0.0? 12372? 2092 ?? ? ? ? S? ? 10:22? 0:00 dovecot/config

root? ? ? 7461? 0.0? 0.0 112704? 972 pts/0? ? S+? 10:22? 0:00 grep --color=auto dovecot

[root@CentOS7 docs]# systemctl start saslauthd

[root@CentOS7 docs]# ps -aux|grep saslauth

root? ? ? 7494? 0.0? 0.0? 74368? 976 ?? ? ? ? Ss? 10:22? 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam

root? ? ? 7495? 0.0? 0.0? 74368? 740 ?? ? ? ? S? ? 10:22? 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam

root? ? ? 7496? 0.0? 0.0? 74368? 740 ?? ? ? ? S? ? 10:22? 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam

root? ? ? 7497? 0.0? 0.0? 74368? 740 ?? ? ? ? S? ? 10:22? 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam

root? ? ? 7498? 0.0? 0.0? 74368? 740 ?? ? ? ? S? ? 10:22? 0:00 /usr/sbin/saslauthd -m /run/saslauthd -a pam

root? ? ? 7510? 0.0? 0.0 112704? 972 pts/0? ? S+? 10:23? 0:00 grep --color=auto saslauth

[root@CentOS7 docs]# ps aux |grep courier-authlib

root? ? ? 7539? 0.0? 0.0 112704? 976 pts/0? ? S+? 10:23? 0:00 grep --color=auto courier-authlib

root? ? 20039? 0.0? 0.0? 4356? 452 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/usr/local/courier-authlib/var/spool/authdaemon/pid -start /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

root? ? 20040? 0.0? 0.0? 64416? 2820 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

root? ? 20041? 0.0? 0.0? 64416? 752 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

root? ? 20042? 0.0? 0.0? 64416? 752 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

root? ? 20043? 0.0? 0.0? 64416? 752 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

root? ? 20044? 0.0? 0.0? 64416? 752 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

root? ? 20045? 0.0? 0.0? 64416? 752 ?? ? ? ? S? ? Nov14? 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond

測試

[root@CentOS7 docs]# /usr/local/courier-authlib/sbin/authtest -s login postmaster@extmail.org extmail

Authentication succeeded.??? // 顯示這個表示成功,測試時使用的是postmaster@extmail.org运挫,因為我們導(dǎo)入的數(shù)據(jù)庫init.sql里面自帶了這個状共。

? ? Authenticated: postmaster@extmail.org? (uid 2525, gid 2525)

? ? Home Directory: /var/mailbox/extmail.org/postmaster??? // 這里需要注意/var/mailbox這個目錄現(xiàn)在我們還沒有創(chuàng)建,后面web訪問的時候如果沒有會報錯,所以提前創(chuàng)建谁帕。

? ? ? ? ? Maildir: /var/mailbox/extmail.org/postmaster/Maildir/

? ? ? ? ? ? Quota: (none)

Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0

Cleartext Password: extmail

? ? ? ? ? Options: (none)

[root@CentOS7 docs]# mkdir /var/mailbox

[root@CentOS7 docs]# chown -R postfix.postfix /var/mailbox/

測試發(fā)信

[root@CentOS7 docs]# printf "postmaster@extmail.org" | openssl base64

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==

[root@CentOS7 docs]#

[root@CentOS7 docs]# printf? "extmail" | openssl base64

ZXh0bWFpbA==

[root@CentOS7 iRedMail-0.9.8]# telnet localhost 25

Trying ::1...

telnet: connect to address ::1: Connection refused

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 mail.hww.com ESMTP Postfix

auth login?? // 登陸

334 VXNlcm5hbWU6??

cG9zdG1hc3RlckBleHRtYWlsLm9yZw==??

334 UGFzc3dvcmQ6

ZXh0bWFpbA==

235 2.7.0 Authentication successful

quit??????? // 退出

221 2.0.0 Bye

Connection closed by foreign host.

配置nginx

修改nginx實現(xiàn)web訪問

#SU_UID=vuser

SU_UID=postfix

#SU_GID=vgroup

SU_GID=postfix

啟動dispatch-init

[root@CentOS7 docs]# /var/www/extsuite/extmail/dispatch-init start

Starting extmail FCGI server...

[root@CentOS7 docs]#? /var/www/extsuite/extman/daemon/cmdserver -v -d

loaded ok

安裝nginx

yum install nginx -y

添加nginx虛擬主機(jī)

[root@CentOS7 docs]# vim /etc/nginx/conf.d/extmail.conf

server {

? ? ? ? listen? ? ? 8080;

? ? ? ? server_name? mail.hww.com;

? ? ? ? index index.html index.htm index.php index.cgi;

? ? ? ? root? /var/www/extsuite/extmail/html/;

? ? ? ? location /extmail/cgi/ {

? ? ? ? ? ? ? ? fastcgi_pass? ? ? ? ? 127.0.0.1:8888;

? ? ? ? ? ? ? ? fastcgi_index? ? ? ? index.cgi;

? ? ? ? ? ? ? ? fastcgi_param? SCRIPT_FILENAME? /var/www/extsuite/extmail/cgi/$fastcgi_script_name;

? ? ? ? ? ? ? ? include? ? ? ? ? ? ? fcgi.conf;

? ? ? ? }?

? ? ? ? location? /extmail/? {

? ? ? ? ? ? ? ? alias? /var/www/extsuite/extmail/html/;

? ? ? ? }?

? ? ? ? location /extman/cgi/ {

? ? ? ? ? ? ? ? fastcgi_pass? ? ? ? ? 127.0.0.1:8888;

? ? ? ? ? ? ? ? fastcgi_index? ? ? ? index.cgi;

? ? ? ? ? ? ? ? fastcgi_param? SCRIPT_FILENAME? /var/www/extsuite/extman/cgi/$fastcgi_script_name;

? ? ? ? ? ? ? ? include? ? ? ? ? ? fcgi.conf;

? ? ? ? }?

? ? ? ? location /extman/ {

? ? ? ? ? ? ? ? alias? /var/www/extsuite/extman/html/;

? ? ? ? }?

? ? ? ? access_log? /var/log/extmail_access.log;

}

創(chuàng)建fcgi.conf文件

[root@CentOS7 docs]# vim /etc/nginx/fcgi.conf

fastcgi_param GATEWAY_INTERFACE CGI/1.1;

fastcgi_param? SERVER_SOFTWARE? ? nginx;

fastcgi_param? QUERY_STRING? ? ? $query_string;

fastcgi_param? REQUEST_METHOD? ? $request_method;

fastcgi_param? CONTENT_TYPE? ? ? $content_type;

fastcgi_param? CONTENT_LENGTH? ? $content_length;

fastcgi_param? SCRIPT_NAME? ? ? ? $fastcgi_script_name;

fastcgi_param? REQUEST_URI? ? ? ? $request_uri;

fastcgi_param? DOCUMENT_ROOT? ? ? $document_root;

fastcgi_param? SERVER_PROTOCOL? ? $server_protocol;

fastcgi_param? REMOTE_ADDR? ? ? ? $remote_addr;

fastcgi_param? REMOTE_PORT? ? ? ? $remote_port;

fastcgi_param? SERVER_ADDR? ? ? ? $server_addr;

fastcgi_param? SERVER_PORT? ? ? ? $server_port;

fastcgi_param? SERVER_NAME? ? ? ? $server_name;

安裝Unix::Syslog

[root@CentOS7 src]# wget http://www.cpan.org/authors/id/M/MH/MHARNISCH/Unix-Syslog-1.1.tar.gz

--2018-11-15 10:43:13--? http://www.cpan.org/authors/id/M/MH/MHARNISCH/Unix-Syslog-1.1.tar.gz

Resolving www.cpan.org (www.cpan.org)... 151.101.78.217, 2a04:4e42:12::729

Connecting to www.cpan.org (www.cpan.org)|151.101.78.217|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 13738 (13K) [application/x-gzip]

Saving to: ‘Unix-Syslog-1.1.tar.gz’

100%[==========================================================================================================>] 13,738? ? ? --.-K/s? in 0s? ? ?

2018-11-15 10:43:13 (197 MB/s) - ‘Unix-Syslog-1.1.tar.gz’ saved [13738/13738]

[root@CentOS7 src]# ls

courier-authlib-0.66.2? ? ? ? ? courier-unicode-1.2? ? ? ? ? extmail-1.2.tar.gz? postfix-3.0.11? ? ? ? Unix-Syslog-1.1.tar.gz

courier-authlib-0.66.2.tar.bz2? courier-unicode-1.2.tar.bz2? extman-1.1.tar.gz? postfix-3.0.11.tar.gz? wget-log

[root@CentOS7 src]# tar zxvf Unix-Syslog-1.1.tar.gz

[root@CentOS7 src]# cd Unix-Syslog-1.1

[root@CentOS7 Unix-Syslog-1.1]# perl Makefile.PL && make && make install

啟動nginx

[root@CentOS7 Unix-Syslog-1.1]# service nginx start

Redirecting to /bin/systemctl start nginx.service

[root@CentOS7 Unix-Syslog-1.1]# ps -aux |grep nginx

root? ? ? 8806? 0.0? 0.0 120780? 2284 ?? ? ? ? Ss? 10:45? 0:00 nginx: master process /usr/sbin/nginx

nginx? ? 8807? 0.0? 0.0 121224? 3172 ?? ? ? ? S? ? 10:45? 0:00 nginx: worker process

nginx? ? 8808? 0.0? 0.0 121224? 3172 ?? ? ? ? S? ? 10:45? 0:00 nginx: worker process

nginx? ? 8809? 0.0? 0.0 121224? 3172 ?? ? ? ? S? ? 10:45? 0:00 nginx: worker process

nginx? ? 8810? 0.0? 0.0 121224? 3172 ?? ? ? ? S? ? 10:45? 0:00 nginx: worker process

root? ? ? 8827? 0.0? 0.0 112704? 972 pts/0? ? S+? 10:45? 0:00 grep --color=auto nginx

[root@CentOS7 Unix-Syslog-1.1]# netstat -lntp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address? ? ? ? ? Foreign Address? ? ? ? State? ? ? PID/Program name? ?

tcp? ? ? ? 0? ? ? 0 0.0.0.0:110? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 7440/dovecot? ? ? ?

tcp? ? ? ? 0? ? ? 0 0.0.0.0:143? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 7440/dovecot? ? ? ?

tcp? ? ? ? 0? ? ? 0 0.0.0.0:80? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 8806/nginx: master?

tcp? ? ? ? 0? ? ? 0 0.0.0.0:8080? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 8806/nginx: master?

tcp? ? ? ? 0? ? ? 0 0.0.0.0:22? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 811/sshd? ? ? ? ? ?

tcp? ? ? ? 0? ? ? 0 127.0.0.1:8888? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 8026/dispatch.fcgi?

tcp? ? ? ? 0? ? ? 0 0.0.0.0:25? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? LISTEN? ? ? 7277/master? ? ? ?

tcp6? ? ? 0? ? ? 0 :::3306? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? ? LISTEN? ? ? 5738/mysqld? ? ? ?

tcp6? ? ? 0? ? ? 0 :::80? ? ? ? ? ? ? ? ? :::*? ? ? ? ? ? ? ? ? ? LISTEN? ? ? 8806/nginx: master?

[root@CentOS7 Unix-Syslog-1.1]#

windows頁面訪問測試

到windows上訪問你服務(wù)器IP的8080端口


extman的登錄賬戶為:root@extmail.org

密碼為:extmail*123*

首次使用需要先添加域峡继,添加之后再修改域,改為可自由注冊匈挖,再注冊用戶就可以登錄發(fā)郵件了:


此處遇到了校驗碼無法正常顯示的問題碾牌,可以先不要校驗碼的功能康愤,先玩玩其它的;有點(diǎn)粗暴了舶吗,后續(xù)待解決

SYS_CAPTCHA_ON = 1??把1改為0表示不啟用校驗碼功能

[root@CentOS7 ~]# vim /var/www/extsuite/extman/webman.cf

#SYS_CAPTCHA_ON = 1

SYS_CAPTCHA_ON = 0?

或者安裝/usr/ports/graphics/p5-GD 征冷, 沒找到資源。誓琼。检激。

登陸成功


添加并設(shè)置域


注冊


登陸

此時報錯了

Can't chdir to /var/mailbox/fish.com/heweiwei/Maildir/, No such file or dire

解決辦法:比較粗暴,只可解燃眉之急腹侣,后續(xù)待解決

使用管理員群發(fā)郵件叔收,用戶自己創(chuàng)建目錄了

群發(fā)后即可登陸如下:


此處大致就搞定了

后續(xù)需修復(fù)一些小問題

參考原文鏈接

CentOS7下搭建postfix郵箱服務(wù)器并實現(xiàn)extmail的web訪問

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市筐带,隨后出現(xiàn)的幾起案子今穿,更是在濱河造成了極大的恐慌,老刑警劉巖伦籍,帶你破解...
    沈念sama閱讀 216,372評論 6 498
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件蓝晒,死亡現(xiàn)場離奇詭異,居然都是意外死亡帖鸦,警方通過查閱死者的電腦和手機(jī)芝薇,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,368評論 3 392
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來作儿,“玉大人洛二,你說我怎么就攤上這事」ッ蹋” “怎么了晾嘶?”我有些...
    開封第一講書人閱讀 162,415評論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長娶吞。 經(jīng)常有香客問我垒迂,道長,這世上最難降的妖魔是什么妒蛇? 我笑而不...
    開封第一講書人閱讀 58,157評論 1 292
  • 正文 為了忘掉前任机断,我火速辦了婚禮,結(jié)果婚禮上绣夺,老公的妹妹穿的比我還像新娘吏奸。我一直安慰自己,他們只是感情好陶耍,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,171評論 6 388
  • 文/花漫 我一把揭開白布奋蔚。 她就那樣靜靜地躺著,像睡著了一般烈钞。 火紅的嫁衣襯著肌膚如雪旺拉。 梳的紋絲不亂的頭發(fā)上产上,一...
    開封第一講書人閱讀 51,125評論 1 297
  • 那天棵磷,我揣著相機(jī)與錄音蛾狗,去河邊找鬼。 笑死仪媒,一個胖子當(dāng)著我的面吹牛沉桌,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播算吩,決...
    沈念sama閱讀 40,028評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼留凭,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了偎巢?” 一聲冷哼從身側(cè)響起蔼夜,我...
    開封第一講書人閱讀 38,887評論 0 274
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎压昼,沒想到半個月后求冷,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,310評論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡窍霞,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,533評論 2 332
  • 正文 我和宋清朗相戀三年匠题,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片但金。...
    茶點(diǎn)故事閱讀 39,690評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡韭山,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出冷溃,到底是詐尸還是另有隱情钱磅,我是刑警寧澤,帶...
    沈念sama閱讀 35,411評論 5 343
  • 正文 年R本政府宣布似枕,位于F島的核電站盖淡,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏菠净。R本人自食惡果不足惜禁舷,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,004評論 3 325
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望毅往。 院中可真熱鬧牵咙,春花似錦、人聲如沸攀唯。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽侯嘀。三九已至另凌,卻和暖如春谱轨,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背吠谢。 一陣腳步聲響...
    開封第一講書人閱讀 32,812評論 1 268
  • 我被黑心中介騙來泰國打工土童, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人工坊。 一個月前我還...
    沈念sama閱讀 47,693評論 2 368
  • 正文 我出身青樓献汗,卻偏偏與公主長得像,于是被迫代替她去往敵國和親王污。 傳聞我的和親對象是個殘疾皇子罢吃,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,577評論 2 353

推薦閱讀更多精彩內(nèi)容