서버 설정 · 4 min read · Oct 29, 2025

완벽한 서버 - CentOS 4.8 서버 x86_64 [ISPConfig 2] - 페이지 5

10 Postfix With SMTP-AUTH And TLS

이제 Postfix와 dovecot를 설치합니다 (dovecot는 우리의 POP3/IMAP 서버가 됩니다):

yum install cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain postfix dovecot

다음으로 SMTP-AUTH와 TLS를 구성합니다:

postconf -e 'smtpd_sasl_local_domain ='
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'broken_sasl_auth_clients = yes'
postconf -e 'smtpd_sasl_authenticated_header = yes'
postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
postconf -e 'inet_interfaces = all'
postconf -e 'mynetworks = 127.0.0.0/8'

우리는 /usr/lib64/sasl2/smtpd.conf를 편집하여 Postfix가 PLAIN 및 LOGIN 로그인을 허용하도록 해야 합니다. 32비트 Centos 4.8에서는 대신 /usr/lib/sasl2/smtpd.conf 파일을 편집해야 합니다. 파일은 다음과 같아야 합니다:

vi /usr/lib64/sasl2/smtpd.conf

| pwcheck_method: saslauthd mech_list: plain login |

그 후 TLS를 위한 인증서를 생성합니다:

mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650

다음으로 Postfix를 TLS에 맞게 구성합니다:

postconf -e 'smtpd_tls_auth_only = no'
postconf -e 'smtp_use_tls = yes'
postconf -e 'smtpd_use_tls = yes'
postconf -e 'smtp_tls_note_starttls_offer = yes'
postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
postconf -e 'smtpd_tls_loglevel = 1'
postconf -e 'smtpd_tls_received_header = yes'
postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
postconf -e 'tls_random_source = dev:/dev/urandom'

그런 다음 Postfix 설치에서 호스트 이름을 설정합니다 (server1.example.com을 자신의 호스트 이름으로 교체해야 합니다):

postconf -e 'myhostname = server1.example.com'

이 구성 단계를 마친 후 /etc/postfix/main.cf는 다음과 같아야 합니다 (모든 주석을 제거했습니다):

cat /etc/postfix/main.cf

| queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix mail_owner = postfix inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost unknown_local_recipient_reject_code = 550 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.2.10/samples readme_directory = /usr/share/doc/postfix-2.2.10/README_FILES smtpd_sasl_local_domain = smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_sasl_authenticated_header = yes smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination mynetworks = 127.0.0.0/8 smtpd_tls_auth_only = no smtp_use_tls = yes smtpd_use_tls = yes smtp_tls_note_starttls_offer = yes smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem smtpd_tls_loglevel = 1 smtpd_tls_received_header = yes smtpd_tls_session_cache_timeout = 3600s tls_random_source = dev:/dev/urandom myhostname = server1.example.com |

기본적으로 CentOS의 dovecot 데몬은 IMAP 및 IMAPs 서비스만 제공합니다. POP3 및 POP3s도 원하므로 dovecot을 그렇게 구성해야 합니다. /etc/dovecot.conf를 편집하고 protocols = imap imaps pop3 pop3s 라인을 추가합니다:

vi /etc/dovecot.conf

| [...] # Base directory where to store runtime data. #base_dir = /var/run/dovecot/ # Protocols we want to be serving: # imap imaps pop3 pop3s protocols = imap imaps pop3 pop3s [...] |

이제 Postfix, saslauthd 및 dovecot을 시작합니다:

chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
chkconfig --levels 235 saslauthd on
chkconfig --levels 235 dovecot on
/etc/init.d/sendmail stop
/etc/init.d/postfix start
/etc/init.d/saslauthd start
/etc/init.d/dovecot start

SMTP-AUTH와 TLS가 제대로 작동하는지 확인하려면 다음 명령을 실행합니다:

telnet localhost 25

Postfix 메일 서버에 연결한 후 다음을 입력합니다:

ehlo localhost

다음과 같은 줄이 보이면

250-STARTTLS

그리고

250-AUTH PLAIN LOGIN

모든 것이 정상입니다.

[root@server1 ssl]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 server1.example.com ESMTP Postfix
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250 8BITMIME
quit
221 Bye
Connection closed by foreign host.
[root@server1 ssl]#
quit

를 입력하여 시스템의 셸로 돌아갑니다.

10.1 Maildir

dovecot은 Maildir 형식을 사용합니다 (mbox 아님), 따라서 서버에 ISPConfig를 설치하는 경우 Management -> Server -> Settings -> Email에서 Maildir을 활성화해야 합니다. ISPConfig가 필요한 구성을 수행합니다.

ISPConfig를 설치하고 싶지 않다면 Postfix를 구성하여 사용자의 Maildir로 이메일을 전달해야 합니다:

postconf -e 'home_mailbox = Maildir/'
postconf -e 'mailbox_command ='
/etc/init.d/postfix restart

11 Apache2 With PHP, Ruby, Python

이제 PHP와 함께 Apache를 설치합니다 (이것은 PHP 4.3.9입니다; CentOS는 PHP5 패키지를 제공하지 않습니다):

yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

그런 다음 /etc/httpd/conf/httpd.conf를 편집합니다:

vi /etc/httpd/conf/httpd.conf

그리고 DirectoryIndex를 다음으로 변경합니다:

| [...] DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl [...] |

이제 시스템이 부팅 시 Apache를 시작하도록 구성합니다:

chkconfig --levels 235 httpd on

Apache를 시작합니다:

/etc/init.d/httpd start

11.1 PHP를 전역적으로 비활성화

(이 서버에 ISPConfig를 설치할 계획이 없다면 이 섹션을 건너뛰십시오!)

ISPConfig에서는 웹사이트별로 PHP를 구성합니다. 즉, 어떤 웹사이트가 PHP 스크립트를 실행할 수 있고 어떤 웹사이트가 실행할 수 없는지를 지정할 수 있습니다. PHP가 전역적으로 비활성화되어야만 작동할 수 있습니다. 그렇지 않으면 모든 웹사이트가 ISPConfig에서 지정한 것과 관계없이 PHP 스크립트를 실행할 수 있습니다.

PHP를 전역적으로 비활성화하려면 /etc/httpd/conf.d/php.conf를 편집하고 AddType 줄을 주석 처리합니다:

vi /etc/httpd/conf.d/php.conf

| # # PHP는 HTML에 내장된 스크립팅 언어로, 개발자가 동적으로 생성된 웹페이지를 작성하기 쉽게 하려고 합니다. # LoadModule php4_module modules/libphp4.so # # PHP 인터프리터가 .php 확장자를 가진 파일을 처리하도록 합니다. # #AddType application/x-httpd-php .php # AddType application/x-httpd-php-source .phps # # 디렉토리 인덱스로 제공될 파일 목록에 index.php를 추가합니다. # DirectoryIndex index.php |

그 후 Apache를 재시작합니다:

/etc/init.d/httpd restart

11.2 mod_ruby 설치

CentOS 4.8에는 mod_ruby 패키지가 없으므로 직접 컴파일해야 합니다. 먼저 몇 가지 필수 패키지를 설치합니다:

yum install httpd-devel ruby ruby-devel

다음으로 mod_ruby를 다운로드하고 설치합니다:

cd /tmp
wget http://modruby.net/archive/mod_ruby-1.3.0.tar.gz
tar zxvf mod_ruby-1.3.0.tar.gz
cd mod_ruby-1.3.0/
./configure.rb --with-apr-includes=/usr/include/apr-0
make
make install

마지막으로 mod_ruby 모듈을 Apache 구성에 추가해야 하므로 /etc/httpd/conf.d/ruby.conf 파일을 생성합니다…

vi /etc/httpd/conf.d/ruby.conf

| LoadModule ruby_module modules/mod_ruby.so |

… 그리고 Apache를 재시작합니다:

/etc/init.d/httpd restart

11.3 mod_python 설치

mod_python을 설치하려면 간단히 실행합니다…

yum install mod_python

… 그리고 그 후 Apache를 재시작합니다:

/etc/init.d/httpd restart
Share: X/Twitter LinkedIn

새 게시물을 받은 편지함에서 받기

스팸은 없습니다. 언제든지 구독 해지 가능합니다.