Почтовый сервер в связке Postfix, Dovecot — различия между версиями
Root (обсуждение | вклад) |
Root (обсуждение | вклад) |
||
Строка 227: | Строка 227: | ||
// (separated with a space).<br/> | // (separated with a space).<br/> | ||
$CONF['password_validation'] = array(<br/> | $CONF['password_validation'] = array(<br/> | ||
− | |||
'/.{5}/' => 'password_too_short 5', # minimum length 5 characters<br/> | '/.{5}/' => 'password_too_short 5', # minimum length 5 characters<br/> | ||
'/([a-zA-Z].*){3}/' => 'password_no_characters 3', # must contain at least 3 characters<br/> | '/([a-zA-Z].*){3}/' => 'password_no_characters 3', # must contain at least 3 characters<br/> | ||
Строка 243: | Строка 242: | ||
// Page Size<br/> | // Page Size<br/> | ||
− | // Set the number of entries that you would like to see | + | // Set the number of entries that you would like to see in one page.<br/> |
− | |||
$CONF['page_size'] = '50'; | $CONF['page_size'] = '50'; | ||
// Default Aliases<br/> | // Default Aliases<br/> | ||
− | //$CONF['default_aliases'] = array ( | + | //$CONF['default_aliases'] = array (<br/> |
− | // 'abuse' => 'abuse@change-this-to-your.domain.tld', | + | // 'abuse' => 'abuse@change-this-to-your.domain.tld',<br/> |
− | // 'hostmaster' => 'hostmaster@change-this-to-your.domain.tld', | + | // 'hostmaster' => 'hostmaster@change-this-to-your.domain.tld',<br/> |
− | // 'postmaster' => 'postmaster@change-this-to-your.domain.tld', | + | // 'postmaster' => 'postmaster@change-this-to-your.domain.tld',<br/> |
− | // 'webmaster' => 'webmaster@change-this-to-your.domain.tld' | + | // 'webmaster' => 'webmaster@change-this-to-your.domain.tld'<br/> |
//); | //); | ||
Строка 301: | Строка 299: | ||
// Transport options<br/> | // Transport options<br/> | ||
// If you want to define additional transport options put them in array below.<br/> | // If you want to define additional transport options put them in array below.<br/> | ||
− | $CONF['transport_options'] = array ( | + | $CONF['transport_options'] = array (<br/> |
− | + | 'virtual', // for virtual accounts<br/> | |
− | + | 'local', // for system accounts<br/> | |
− | + | 'relay' // for backup mx<br/> | |
− | ); | + | );<br/> |
// Transport default<br/> | // Transport default<br/> | ||
// You should define default transport. It must be in array above.<br/> | // You should define default transport. It must be in array above.<br/> | ||
Строка 340: | Строка 338: | ||
// 0 => only reply to the first mail while on vacation<br/> | // 0 => only reply to the first mail while on vacation<br/> | ||
// 1 => reply on every mail<br/> | // 1 => reply on every mail<br/> | ||
− | $CONF['vacation_choice_of_reply'] = array ( | + | $CONF['vacation_choice_of_reply'] = array (<br/> |
− | + | 0 => 'reply_once', // Sends only Once the message during Out of Office<br/> | |
− | + | # considered annoying - only send a reply on every mail if you really need it<br/> | |
− | + | # 1 => 'reply_every_mail', // Reply on every email<br/> | |
− | + | 60*60 *24*7 => 'reply_once_per_week' // Reply if last autoreply was at least a week ago<br/> | |
− | ); | + | );<br/> |
// End Vacation Stuff. | // End Vacation Stuff. | ||
Строка 549: | Строка 547: | ||
// file (config.local.php) instead of editing this file and override some<br/> | // file (config.local.php) instead of editing this file and override some<br/> | ||
// settings there.<br/> | // settings there.<br/> | ||
− | if (file_exists(dirname(__FILE__) . '/config.local.php')) { | + | if (file_exists(dirname(__FILE__) . '/config.local.php')) {<br/> |
− | + | include(dirname(__FILE__) . '/config.local.php');<br/> | |
− | } | + | }<br/> |
// END OF CONFIG FILE | // END OF CONFIG FILE |
Версия 18:55, 22 апреля 2015
При установке будем ориентироваться на этот мануал: http://dummyluck.com/page/pochtovyi_server_nastroika_opisanie
Настройку будем производить для сервера с одним доменом. Система FreeBSD 10.1
1. Подготовка.
прописываем хостнейм /etc/rc.conf
hostname="mail.megapuper.ru"
делаем изменения в хостах /etc/hosts
127.0.0.1 localhost 109.172.52.114 megapuper.ru 109.172.52.114 mail.megapuper.ru
создаём пользователя и группу vmail
# pw groupadd vmail -g 5000 # pw useradd vmail -g vmail -s /sbin/nologin -u 5000
сразу отключаем sendmail
/etc/rc.conf
sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO"
/etc/periodic.conf
daily_clean_hoststat_enable="NO" daily_status_mail_rejects_enable="NO" daily_status_include_submit_mailq="NO" daily_submit_queuerun="NO"
2. Ставим Nginx, MySQL, PHP, PHP-extension. Этот web-сервер будет использоваться для postfixadmin.
Здесь коротко, ибо уже тыщу раз ставилось)
Nginx cтавим из пакетов
# pkg install nginx
основной конфиг /usr/local/etc/nginx/nginx.conf
user www; worker_processes 2; pid /var/run/nginx.pid; events { worker_connections 1024; } http { access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; include /usr/local/etc/nginx/mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; client_max_body_size 5m; server_names_hash_bucket_size 64; types_hash_max_size 2048; types_hash_bucket_size 64; include /usr/local/etc/nginx/conf/*.conf; }
конфиг виртуального хоста /usr/local/etc/nginx/conf/postfix.conf
server { listen 80; server_name postfix.megapuper.ru; root /usr/local/www/postfix; index index.php index.html index.htm; access_log /var/log/nginx/postfix.access.log; error_log /var/log/nginx/postfix.error.log; location / { # try_files $uri $uri/ /index.php?$uri&$args; } location ~ \.php$ { fastcgi_pass 127.0.0.1:10000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; fastcgi_intercept_errors on; include fastcgi_params; } }
PHP и нужные PHP-extension тоже ставим из пакетов
# pkg install php55 # pkg install php55-* (пригодятся php55-ctype php55-dom php55-gd php55-hash php55-iconv php55-imap php55-json php55-mbstring php55-mcrypt php55-mysql php55-mysqli php55-session php55-xml)
конфиг php-fpm /usr/local/etc/php-fpm.conf
[global] error_log = /var/log/php/php-fpm.log pid = /var/run/php-fpm.pid log_level = notice include=/usr/local/etc/php/*.conf
конфиг для виртуального хоста /usr/local/etc/php/postfix.conf
[postfix] prefix = /usr/local/www/$pool listen = 127.0.0.1:10000 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0660 user = www group = www pm = dynamic pm.max_children = 4 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 pm.max_requests = 100 ;pm.status_path = /status/php-fpm/$pool request_terminate_timeout = 0 request_slowlog_timeout = 1m slowlog = /var/log/php/$pool.slow.log catch_workers_output = yes
MySQL тоже из пакетов
# pkg install mysql56-server
простенький конфиг /etc/my.cnf
[mysqld] bind-address=127.0.0.1
в конфигах. где используется подключение к базе указываем хост 127.0.0.1
После этого имеем готовый web-сервер можно переходить к установке postfixadmin
3. Установка PostfixAdmin
Скачиваем последнюю версию отсюда http://sourceforge.net/projects/postfixadmin/ и заливаем на web-сервер
создаём базу и даём права пользователю
> create database postfix character set utf8 collate utf8_general_ci; > grant all on postfix.* to postfix@127.0.0.1 identified by 'пароль';
Правим основной конфиг postfixadmin config.inc.php
Spoiler
6. Устанавливаем Postfix.
7. Устанавливаем Dovecot.