差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:phplist [2019/03/26 22:15] – [編輯 phplist 設定檔] jonathan_tsaitech:phplist [2019/03/27 00:42] (目前版本) – [編輯 phplist 設定檔] jonathan_tsai
行 1: 行 1:
 +====== Centos7 安裝 phplist ======
 +  * 安裝環境 : CentOS 7 
 +  * phplist : 3.4.0
 +
 +
 +===== 安裝程序 =====
 +  * 安裝主要套件 <code sh>
 +yum install epel-release
 +rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
 +yum install php72w php72w-cli php72w-common php72w-imap php72w-mbstring php72w-xml php72w-mysqli php72w-gd mariadb mariadb-server httpd wget 
 +</code>
 +  * <code sh>
 +su - root
 +wget https://jaist.dl.sourceforge.net/project/phplist/phplist/3.4.0/phplist-3.4.0.tgz
 +tar -xvf phplist-3.4.0.tgz 
 +cp -a phplist-3.4.0/public_html/* /var/www/html/
 +</code>
 +  * 設定與啟動 apache / mariadb <code sh>
 +vi /etc/php.ini</code><file>
 +:
 +[Date]
 +; Defines the default timezone used by the date functions
 +; http://php.net/date.timezone
 +date.timezone = Asia/Taipei
 +:
 +</file><code sh>
 +vi /etc/httpd/conf/httpd.conf</code><file>
 +:
 +IfModule dir_module>
 +    DirectoryIndex index.php index.html
 +</IfModule>
 +:
 +</file><code sh>
 +systemctl restart httpd
 +systemctl start mariadb
 +mysql -u root
 +</code>**password 要依照自己需要設定**<code sql>
 +CREATE DATABASE phplistdb CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 +CREATE USER 'phplist'@'localhost' IDENTIFIED BY '**password**';
 +GRANT ALL PRIVILEGES ON phplistdb.* TO 'phplist'@'localhost';
 +FLUSH PRIVILEGES;
 +exit
 +</code>
 +
 +===== 編輯 phplist 設定檔 =====
 +  * /var/www/html/lists/config/config.php <file>
 +:
 +$default_system_language = "zh_TW";
 +:
 +$database_host = 'localhost';
 +// what is the name of the database we are using
 +$database_name = 'phplistdb';
 +// what user has access to this database
 +$database_user = 'phplist';
 +// and what is the password to login to control the database
 +$database_password = '**password**';
 +:
 +define('PHPMAILERHOST', '172.16.0.244');
 +// if TEST is set to 1 (not 0) it will not actually send ANY messages, but display what it would have sent
 +// this is here, to make sure you edited the config file and mails are not sent "accidentally"
 +// on unmanaged systems
 +define('TEST', 0);
 +:
 +$bounce_protocol = 'pop';
 +// set this to 0, if you set up a cron to download bounces regularly by using the
 +// commandline option. If this is 0, users cannot run the page from the web
 +// frontend. Read README.commandline to find out how to set it up on the
 +// commandline
 +define('MANUALLY_PROCESS_BOUNCES', 1);
 +// when the protocol is pop, specify these three
 +$bounce_mailbox_host = '172.16.0.244';
 +$bounce_mailbox_user = 'noreply';
 +$bounce_mailbox_password = '**password**';
 +:
 +define("PHPMAILER_SECURE",'tls');
 +define('PHPMAILERHOST', '172.16.0.244');
 +define('PHPMAILERPORT', 587);
 +$phpmailer_smtpuser = 'noreply';
 +$phpmailer_smtppassword = '**password**';
 +$phpmailer_smtpoptions = array(
 +    'ssl' => array(
 +        'verify_peer' => false,
 +        'verify_peer_name' => false,
 +        'allow_self_signed' => true
 +    )
 +);
 +
 +:
 +</file>
 +  * 更改目錄權限 <code sh>
 +chown -R apache:apache /var/lib/php/session/
 +mkdir -p /var/www/html/images
 +chown apache:apache /var/www/html/images
 +</code>
 +
 +===== 進入網頁設定 =====
 +  * 網址 - http://serverIP/lists/admin
 +  - 看到 <code>Database has not been initialised. go to Initialise Database to continue</code> 點 **[Initialise Database]** 建立基本資料
 +  - 填寫基本表格資料 點 [Continue] 就自動建立資料表
 +  - 會顯示檢查是否相關 php 套件都有安裝好 點 [Not subscribed] 才會出現繼續設定的按鈕 {{:tech:2019032601.png}}
 +
 +===== 寄信設定 =====
 +<note warning>因為現在的郵件主機 iRedMail / MailCow 都需要透過 SMTP SSL/TLS 寄信, 且信件的來源必須是該認證帳號的信箱, 因此
 +  * config.php 內必須要設定 $phpmailer_smtpoptions 才能通過 SSL 加密協定, 否則 Mail Server 會出現類似以下的訊息 <file>
 +Mar 26 23:42:45 ct-edm postfix/submission/smtpd[12734]: connect from unknown[172.16.0.101]
 +Mar 26 23:42:45 ct-edm postfix/submission/smtpd[12734]: Anonymous TLS connection established from unknown[172.16.0.101]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
 +Mar 26 23:42:45 ct-edm postfix/submission/smtpd[12734]: lost connection after STARTTLS from unknown[172.16.0.101]
 +Mar 26 23:42:45 ct-edm postfix/submission/smtpd[12734]: disconnect from unknown[172.16.0.101]
 +</file>
 +  * phplist 的 config 設定 person in charge of this system 必須是寄送 Mail Server 內的信箱 Exp. 寄送信箱是 edm.ichiayi.com 則 smtpuser 是 noreply 就要填寫 [email protected]
 +</note>
 +
 +  * config.php 內的 $phpmailer_smtpoptions 範例 <file>
 +:
 +$phpmailer_smtpuser = 'noreply';
 +$phpmailer_smtppassword = '**password**';
 +
 +$phpmailer_smtpoptions = array(
 +    'ssl' => array(
 +        'verify_peer' => false,
 +        'verify_peer_name' => false,
 +        'allow_self_signed' => true
 +    )
 +);
 +:
 +</file>
 +  * phplist config 設定畫面參考  {{:tech:2019032602.png}}
 +===== 參考網址 =====
 +  * https://www.phplist.org/manual/ch028_installation.xhtml
 +  * https://resources.phplist.com/system/config/phpmailer_smtpoptions
 +
 +{{tag>phplist centos7}}