서버 설정 · 2 min read · Sep 29, 2025
완벽한 스팸스네이크 - 우분투 자운티 재칼로프 - 페이지 2
10. Apache2
apt-get install apache2 apache2-suexec apache2-doc apache2-mpm-prefork apache2-utils libexpat1다음으로 PHP5를 Apache 모듈로 설치합니다:
aptitude install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl다음으로 /etc/apache2/mods-available/dir.conf 파일을 편집하고 DirectoryIndex 줄을 변경합니다:
#DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml
이제 몇 가지 Apache 모듈(재작성, suexec, 포함)을 활성화해야 합니다.
a2enmod rewrite
a2enmod suexec
a2enmod includeApache를 재시작합니다:
/etc/init.d/apache2 restart11. Postfix 및 MySQL
패키지를 설치합니다:
apt-get install postfix postfix-mysql postfix-doc mysql-server mysql-client procmailMySQL:
MySQL 루트 사용자에 대한 비밀번호를 제공하라는 메시지가 표시됩니다. 이 비밀번호는 root@localhost 사용자와 [email protected] 모두에 유효하므로 나중에 MySQL 루트 비밀번호를 수동으로 지정할 필요가 없습니다:
MySQL “root” 사용자에 대한 새 비밀번호: <– yourrootsqlpassword
MySQL “root” 사용자에 대한 비밀번호 반복: <– yourrootsqlpassword
Postfix:
두 가지 질문에 답해야 합니다. 다음과 같이 답하십시오:
메일 구성의 일반 유형: <– 인터넷 사이트
시스템 메일 이름: <– server1.example.com
MySQL이 localhost뿐만 아니라 모든 인터페이스에서 수신 대기하도록 하려면 /etc/mysql/my.cnf 파일을 편집하고 bind-address = 127.0.0.1 줄의 주석을 제거합니다:
[...]
# 대신 skip-networking의 기본값은 이제
# localhost에서만 수신 대기하는 것입니다. 이는 더 호환성이 좋고 덜 안전하지 않습니다.
#bind-address = 127.0.0.1
[...]그런 다음 MySQL을 재시작합니다:
/etc/init.d/mysql restart이제 네트워킹이 활성화되었는지 확인합니다. 다음을 실행합니다:
netstat -tap | grep mysql출력은 다음과 같아야 합니다:
tcp 0 0 *:mysql *:* LISTEN 4318/mysqldPostfix를 중지합니다:
postfix stop다음과 같이 Postfix를 편집하고자 합니다:
master.cf 편집:
pickup 서비스 유형 아래에 두 항목을 추가해야 합니다. pickup 서비스는 로컬 메일(로컬은 “이 머신에서”)을 “픽업”하고 배달합니다. 이는 이 머신에서 생성된 메일에 대한 콘텐츠 필터링을 우회하는 방법입니다.
완료되면 다음과 같아야 합니다:
pickup fifo n - - 60 1 pickup
-o content_filter=
-o receive_override_options=no_header_body_checksmain.cf 편집:
postconf -e "alias_maps = hash:/etc/aliases"
newaliases
postconf -e "myorigin = example.com"
postconf -e "myhostname = server1.example.com"
postconf -e "mynetworks = 127.0.0.0/8, 192.168.0.0/24"
postconf -e "message_size_limit = 10485760"
postconf -e "local_transport = error:No local mail delivery"
postconf -e "mydestination = "
postconf -e "local_recipient_maps = "
postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"/etc/postfix/virtual을 생성하고 다음을 추가합니다:
postmaster [email protected]
abuse [email protected]
root [email protected]계속:
postmap /etc/postfix/virtual
postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"/etc/postfix/relay_recipients를 생성하고 다음을 추가합니다:
@example.com OK
@example2.com OK계속:
postmap /etc/postfix/relay_recipients
postconf -e "transport_maps = hash:/etc/postfix/transport"/etc/postfix/transport를 생성하고 다음을 추가합니다:
example.com smtp:[192.168.0.x]
example2.com smtp:[192.168.0.x]계속:
postmap /etc/postfix/transport
postconf -e "relay_domains = hash:/etc/postfix/relay_domains"/etc/postfix/relay_domains를 생성하고 다음을 추가합니다:
example.com OK
example2.com OK계속:
postmap /etc/postfix/relay_domains
postconf -e "smtpd_helo_required = yes"
postconf -e "smtpd_sender_restrictions = reject_non_fqdn_sender, reject_unknown_sender_domain, permit"
postconf -e "smtpd_recipient_restrictions = reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, permit_mynetworks, reject_unauth_destination, reject_unauth_pipelining, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net, permit"
postconf -e "smtpd_data_restrictions = reject_unauth_pipelining"Postfix 구성을 최종적으로 확인해 봅시다:
less /etc/postfix/main.cf파일의 내용을 확인하여 오류가 있는지 확인하고 필요시 수정합니다. Postfix를 시작합니다:
postfix startPostfix가 응답하는지 확인합니다:
telnet 127.0.0.1 25다음과 같은 메시지가 표시되어야 합니다:
220 [yourFQDNhere] ESMTP Postfix (Ubuntu)12. MailScanner Razor Pyzor DCC Clamav 설치
apt-get install mailscanner razor pyzor clamav-daemon
MailScanner부터 시작하겠습니다. 방금 저장소에서 설치한 MailScanner는 매우 오래된 버전이므로 이제 이를 제거하고 소스에서 MailScanner 패키지를 설치하겠습니다. 위의 작업은 종속성만 설치하기 위해 수행됩니다.
apt-get remove mailscannerhttp://www.mailscanner.info/files/4/tar/MailScanner-install-4.75.11-1.tar.gz를 /usr/src/mailscanner/에 다운로드하고 다음을 실행합니다:
tar xvfz MailScanner-install-4.75.11-1.tar.gz
cd MailScanner-install-4.75.11
./install.sh기본 MailScanner를 비활성화합니다:
mv /etc/MailScanner /etc/MailScanner.dist새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.