완벽한 서버 - Debian 10(Nginx, BIND, Dovecot, ISPConfig 3.2)
이 튜토리얼은 다음 OS 버전에 대해 존재합니다.
- 데비안 10(버스터)
- 데비안 6(스퀴즈)
이 페이지에서
- 1 서문
- 2 SSH 서버 설치
- 3 셸 텍스트 편집기 설치(선택 사항)\n
- 4 호스트 이름 구성\n
- 5 Debian 설치 업데이트
- 6 기본 셸 변경
- 7 시스템 시계 동기화\n
- 8 Postfix, Dovecot, MySQL, rkhunter 및 binutils 설치
- 9 Amavisd-new, SpamAssassin 및 ClamAV 설치
- 10 Nginx, PHP(PHP-FPM) 및 Fcgiwrap 설치
- 10.1 phpMyAdmin 설치
이 튜토리얼은 ISPConfig 3.2 설치를 위해 Debian 10 서버(Nginx, BIND, Dovecot 포함)를 준비하는 방법과 ISPConfig 3.2를 설치하는 방법을 보여줍니다. ISPConfig 3은 웹 브라우저를 통해 다음 서비스를 구성할 수 있는 웹 호스팅 제어판입니다. Apache 또는 nginx 웹 서버, Postfix 메일 서버, Courier 또는 Dovecot IMAP/POP3 서버, MySQL, BIND 또는 MyDNS 네임서버, PureFTPd, SpamAssassin, ClamAV 등이 있습니다. 이 설정은 Nginx 웹 서버, BIND를 DNS 서버로, Dovecot을 IMAP/POP3 서버로 포함합니다.
1 서문
이 자습서에서는 호스트 이름 server1.example.com을 IP 주소 192.168.0.100 및 게이트웨이 192.168.0.1과 함께 사용합니다. 이러한 설정은 사용자에 따라 다를 수 있으므로 적절하게 교체해야 합니다. 계속 진행하기 전에 Debian 10의 최소 설치가 필요합니다. 이것은 호스팅 제공업체의 Debian 최소 이미지이거나 최소 Debian 서버 튜토리얼을 사용하여 기본 시스템을 설정할 수 있습니다.
아래의 모든 명령은 루트 사용자로 실행됩니다. 루트 사용자로 직접 로그인하거나 일반 사용자로 로그인한 후 다음 명령을 사용하십시오.
su -
진행하기 전에 서버에서 루트 사용자가 되십시오. 중요: su만이 아니라 su를 사용해야 합니다. 그렇지 않으면 PATH 변수가 데비안에서 잘못 설정됩니다.
2 SSH 서버 설치
시스템 설치 중에 OpenSSH 서버를 설치하지 않은 경우 지금 수행할 수 있습니다.
apt-get -y install ssh openssh-server
지금부터 PuTTY와 같은 SSH 클라이언트를 사용하고 워크스테이션에서 Debian 10 서버에 연결하고 이 자습서의 나머지 단계를 따를 수 있습니다.
3 쉘 텍스트 편집기 설치(선택 사항)
이 가이드에서는 nano 텍스트 편집기를 사용하겠습니다. 일부 사용자는 클래식 vi 편집기를 선호하므로 여기에 두 편집기를 모두 설치하겠습니다. 기본 vi 프로그램은 데비안과 우분투에서 이상한 동작을 합니다. 이 문제를 해결하기 위해 vim-nox를 설치합니다.
apt-get -y install nano vim-nox
(joe와 같은 다른 텍스트 편집기를 사용하는 경우에는 이 작업을 수행할 필요가 없습니다.)
4 호스트 이름 구성
서버의 호스트 이름은 "server1.example.com"과 같은 하위 도메인이어야 합니다. "example.com"과 같은 하위 도메인 부분이 없는 도메인 이름을 호스트 이름으로 사용하지 마십시오. 나중에 메일 설정에 문제가 발생할 수 있습니다. 먼저 /etc/hosts에서 호스트 이름을 확인하고 필요한 경우 변경해야 합니다. 줄은 "IP 주소 - 공백 - 도메인을 포함한 전체 호스트 이름 - 공백 - 하위 도메인 부분"이어야 합니다. /etc/hosts를 편집합니다. 다음과 같이 만드십시오.
nano /etc/hosts
127.0.0.1 localhost.localdomain localhost 192.168.0.100 server1.example.com server1 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
그런 다음 /etc/hostname 파일을 편집합니다.
nano /etc/hostname
우리의 경우에는 하위 도메인 부분만 포함해야 합니다.
server1
마지막으로 서버를 재부팅하여 변경사항을 적용합니다.
reboot
다시 로그인하고 다음 명령을 사용하여 호스트 이름이 올바른지 확인하십시오.
hostname
hostname -f출력은 다음과 같아야 합니다.
:/tmp# hostname -f
server1.example.com5 데비안 설치 업데이트
먼저 /etc/apt/sources.list에 buster/updates 리포지토리가 포함되어 있는지 확인합니다(이렇게 하면 항상 ClamAV 바이러스 스캐너에 대한 최신 업데이트를 받을 수 있습니다. 이 프로젝트는 릴리스를 매우 자주 게시하며 때로는 이전 버전이 작동을 멈춥니다). contrib 및 non-free 리포지토리가 활성화되어 있습니다.
nano /etc/apt/sources.list
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/debian-security buster/updates main contrib non-free
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free달리다
apt-get update
apt 패키지 데이터베이스를 업데이트하고
apt-get upgrade
최신 업데이트를 설치합니다(있는 경우).
6 기본 쉘 변경
/bin/sh는 /bin/dash에 대한 심볼릭 링크이지만 /bin/dash가 아니라 /bin/bash가 필요합니다. 그러므로 우리는 이렇게 합니다:
dpkg-reconfigure dash
대시를 기본 시스템 셸(/bin/sh)로 사용하시겠습니까? <-- 아니요
이렇게 하지 않으면 ISPConfig 설치가 실패합니다.
7 시스템 시계 동기화
인터넷을 통해 시스템 시계를 NTP(네트워크 시간 프로토콜) 서버와 동기화하는 것이 좋습니다. 간단히 실행
apt-get install ntp
시스템 시간은 항상 동기화됩니다.
8 Postfix, Dovecot, MySQL, rkhunter, binutils 설치
단일 명령으로 Postfix, Dovecot, MySQL, rkhunter 및 Binutils를 설치할 수 있습니다.
apt-get install postfix postfix-mysql postfix-doc mariadb-client mariadb-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d dovecot-mysql dovecot-sieve dovecot-lmtpd sudo curl
다음과 같은 질문을 받게 됩니다.
일반적인 메일 구성 유형: <-- 인터넷 사이트
시스템 메일 이름: <-- server1.example.comMariaDB/MySQL 설치를 보호하고 테스트 데이터베이스를 비활성화하려면 다음 명령을 실행하십시오.
mysql_secure_installation
설치하는 동안 새 암호를 설정하기만 하면 MariaDB 루트 암호를 변경할 필요가 없습니다. 다음과 같이 질문에 답하십시오.
Change the root password? [Y/n] <-- y
New password: <-- Enter a new database root password
Re-enter new password: <-- Repeat the database root password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Remove test database and access to it? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y다음으로 Postfix에서 TLS/SSL 및 제출 포트를 엽니다.
nano /etc/postfix/master.cf
다음과 같이 제출 및 smtps 섹션의 주석을 제거하고 필요한 경우 줄을 추가하여 master.cf 파일의 이 섹션이 아래와 같이 정확히 보이도록 합니다. 중요: smtps 및 submit로 시작하는 줄 앞의 #을 제거하고 이 줄 뒤의 -o 줄에서도 제거하십시오!
[...]
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
[...]나중에 Postfix를 다시 시작하십시오.
service postfix restart
우리는 MariaDB가 localhost뿐만 아니라 모든 인터페이스에서 수신 대기하기를 원하므로 /etc/mysql/mariadb.conf.d/50-server.cnf를 편집하고 bind-address = 127.0.0.1 줄을 주석 처리합니다.
nano /etc/mysql/mariadb.conf.d/50-server.cnf
[...]
# Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. #bind-address = 127.0.0.1
[...]파일을 저장합니다. 그런 다음 나중에 PHPMyAdmin을 사용하여 루트 사용자로 연결할 수 있도록 MariaDB의 암호 인증 방법을 기본으로 설정합니다.
echo "update mysql.user set plugin = 'mysql_native_password' where user='root';" | mysql -u root
/etc/mysql/debian.cnf 파일을 편집하고 비밀번호라는 단어로 시작하는 행에 MYSQL/MariaDB 루트 비밀번호를 두 번 설정합니다.
nano /etc/mysql/debian.cnf
추가해야 하는 MySQL 루트 암호는 빨간색으로 표시됩니다. 이 예에서 암호는 "howtoforge"입니다.
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = root
password = howtoforge
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password = howtoforge
socket = /var/run/mysqld/mysqld.sock
basedir = /usrError in accept: Too many open files 오류를 방지하기 위해 지금 MariaDB에 대해 더 높은 파일 열기 제한을 설정할 것입니다.
편집기로 /etc/security/limits.conf 파일을 엽니다.
nano /etc/security/limits.conf
파일 끝에 다음 줄을 추가하십시오.
mysql soft nofile 65535
mysql hard nofile 65535그런 다음 mkdir 명령을 사용하여 새 디렉터리 /etc/systemd/system/mysql.service.d/를 만듭니다.
mkdir -p /etc/systemd/system/mysql.service.d/
내부에 새 파일을 추가하십시오.
nano /etc/systemd/system/mysql.service.d/limits.conf
해당 파일에 다음 줄을 붙여넣습니다.
[Service]
LimitNOFILE=infinity파일을 저장하고 나노 편집기를 닫습니다.
그런 다음 systemd를 다시 로드하고 MariaDB를 다시 시작합니다.
systemctl daemon-reload
systemctl restart mariadb다음 경고를 무시하십시오. "경고: 장치 파일, 소스 구성 파일 또는 mariadb.service의 드롭인이 디스크에서 변경되었습니다. 장치를 다시 로드하려면 systemctl daemon-reload를 실행하십시오.".
dbconfig-common 시스템을 설치합니다.
apt-get install dbconfig-common dbconfig-mysql
현재 Debian dbconfig-common 시스템에 나중에 RoundCube 설치를 방해하는 문제가 있습니다. 다음 명령을 실행하여 수정하십시오.
sed -i -r 's/_dbc_nodb="yes" dbc_mysql_exec/_dbc_nodb="yes"; dbc_mysql_exec/g' /usr/share/dbconfig-common/internal/mysql
이제 네트워킹이 활성화되었는지 확인하십시오. 달리다
netstat -tap | grep mysql
출력은 다음과 같아야 합니다.
:~#
9 Amavisd-new, SpamAssassin 및 ClamAV 설치
amavisd-new, SpamAssassin 및 ClamAV를 설치하려면 다음을 실행합니다.
apt-get install amavisd-new spamassassin clamav clamav-daemon unzip bzip2 arj nomarch lzop cabextract p7zip p7zip-full unrar lrzip apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl libdbd-mysql-perl postgrey
ISPConfig 3 설정은 SpamAssassin 필터 라이브러리를 내부적으로 로드하는 amavisd를 사용하므로 SpamAssassin을 중지하여 일부 RAM을 확보할 수 있습니다.
systemctl stop spamassassin
systemctl disable spamassassin10 Nginx, PHP(PHP-FPM) 및 Fcgiwrap 설치
Nginx는 다음과 같이 설치할 수 있는 Debian용 패키지로 제공됩니다.
apt-get install nginx
시스템에 Apache2가 이미 설치되어 있으면 지금 중지하십시오...
systemctl stop apache2
\Failed to stop apache2.service: Unit apache2.service not loaded.\ 메시지는 정상이며 오류를 나타내지 않습니다.
... Apache 시스템 시작 링크를 제거합니다.
systemctl disable apache2
나중에 nginx를 시작합니다.
systemctl start nginx
(Apache2와 nginx가 모두 설치되어 있으면 ISPConfig 3 설치 프로그램이 어느 것을 사용할지 묻습니다. 이 경우에는 nginx로 대답합니다. 둘 중 하나만 설치되어 있으면 ISPConfig가 필요한 구성을 자동으로 수행합니다.)
다음과 같이 설치하는 PHP-FPM(PHP-FPM(FastCGI Process Manager)은 모든 규모의 사이트, 특히 사용량이 많은 사이트에 유용한 몇 가지 추가 기능이 포함된 대체 PHP FastCGI 구현입니다)을 통해 nginx에서 PHP 7.3이 작동하도록 만들 수 있습니다.
apt-get install php7.3-fpm
PHP-FPM은 소켓 /var/run/php/php7.3-fpm.sock에서 FastCGI 서버를 실행하는 데몬 프로세스입니다.
PHP에서 MySQL 지원을 받으려면 php7.3-mysql 패키지를 설치할 수 있습니다. 다른 PHP 모듈을 설치하는 것이 좋으며 애플리케이션에 필요할 수도 있습니다. 다음과 같이 사용 가능한 PHP 모듈을 검색할 수 있습니다.
apt-cache search php7
필요한 것을 선택하고 다음과 같이 설치하십시오.
apt-get install php7.3 php7.3-common php7.3-gd php7.3-mysql php7.3-imap php7.3-cli php7.3-cgi php-pear mcrypt imagemagick libruby php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl memcached php-memcache php-imagick php-gettext php7.3-zip php7.3-mbstring memcached php7.3-soap php7.3-fpm php7.3-opcache php-apcu
다음 열기 /etc/php/7.3/fpm/php.ini...
nano /etc/php/7.3/fpm/php.ini
... cgi.fix_pathinfo=0 및 시간대를 설정합니다.
[...] cgi.fix_pathinfo=0 [...] date.timezone="Europe/Berlin" [...]
(/usr/share/zoneinfo 디렉토리 및 하위 디렉토리에서 사용 가능한 모든 시간대를 찾을 수 있습니다.)
이제 PHP-FPM을 다시 로드합니다.
systemctl restart php7.3-fpm
nginx에서 CGI 지원을 받으려면 Fcgiwrap을 설치합니다.
Fcgiwrap은 복잡한 CGI 스크립트에도 작동해야 하는 CGI 래퍼이며 각 가상 호스트가 자체 cgi-bin 디렉토리를 사용할 수 있기 때문에 공유 호스팅 환경에 사용할 수 있습니다.
fcgiwrap 패키지를 설치합니다.
apt-get install fcgiwrap
설치 후에는 fcgiwrap 데몬이 이미 시작되어 있어야 합니다. 해당 소켓은 /var/run/fcgiwrap.socket입니다. 실행 중이 아니면 fservice fcgiwrap 스크립트를 사용하여 시작할 수 있습니다.
그게 다야! 이제 nginx 가상 호스트를 만들면 ISPConfig가 올바른 가상 호스트 구성을 처리합니다.
10.1 phpMyAdmin 설치
Debian 10부터 PHPMyAdmin은 더 이상 .deb 패키지로 사용할 수 없습니다. 따라서 소스에서 설치하겠습니다.
PHPMyadmin용 폴더 생성:
mkdir /usr/share/phpmyadmin
mkdir /etc/phpmyadmin
mkdir -p /var/lib/phpmyadmin/tmp
chown -R www-data:www-data /var/lib/phpmyadmin
touch /etc/phpmyadmin/htpasswd.setup/tmp 디렉토리로 이동하여 PHPMyAdmin 소스를 다운로드합니다.
cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/4.9.0.1/phpMyAdmin-4.9.0.1-all-languages.tar.gz다운로드한 아카이브 파일의 압축을 풀고 파일을 /usr/share/phpmyadmin 폴더로 이동하고 /tmp 디렉토리를 정리합니다.
tar xfz phpMyAdmin-4.9.0.1-all-languages.tar.gz
mv phpMyAdmin-4.9.0.1-all-languages/* /usr/share/phpmyadmin/
rm phpMyAdmin-4.9.0.1-all-languages.tar.gz
rm -rf phpMyAdmin-4.9.0.1-all-languages제공된 샘플 파일을 기반으로 PHPMyaAdmin에 대한 새 구성 파일을 만듭니다.
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
nano 편집기로 구성 파일을 엽니다.
nano /usr/share/phpmyadmin/config.inc.php
32자 길이여야 하는 보안 암호(복어 암호)를 설정합니다.
$cfg['blowfish_secret'] = 'bD3e6wva9fnd93jVsb7SDgeiBCd452Dh'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
내 예제 복어 비밀을 사용하지 말고 직접 설정하십시오!
그런 다음 PHPMyAdmin이 임시 파일을 저장하는 데 사용할 디렉토리를 설정하는 행을 추가하십시오.
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';
다음 단계에서는 phpMyadmin 구성 저장소(데이터베이스)를 구성합니다.
루트 사용자로 MariaDB에 로그인합니다.
mysql -u root -p
MariaDB 셸에서 PHPMyAdmin용 새 데이터베이스를 만듭니다.
MariaDB [(none)]> CREATE DATABASE phpmyadmin;
그런 다음 새 사용자를 만듭니다.
MariaDB [(none)]> CREATE USER 'pma'@'localhost' IDENTIFIED BY 'mypassword';
위와 아래 명령에서 mypassword라는 단어를 원하는 보안 암호로 바꾸고 두 번 모두 같은 암호를 사용하십시오. 그런 다음 이 데이터베이스에 대한 사용자 액세스 권한을 부여하고 데이터베이스 권한을 다시 로드합니다.
MariaDB [(none)]> GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT마지막으로 SQL 테이블을 데이터베이스에 로드합니다.
mysql -u root -p phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql
요청 시 MariaDB 루트 암호를 입력합니다.
이제 우리가 해야 할 일은 구성 파일에서 phpmyadmin 사용자 세부 정보를 설정하는 것입니다. nano 편집기에서 파일을 다시 엽니다.
nano /usr/share/phpmyadmin/config.inc.php
아래 줄이 보일 때까지 아래로 스크롤하고 편집합니다.
/* User used to manipulate with storage */
$cfg['Servers'][$i]['controlhost'] = 'localhost';
$cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'mypassword';
/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';내가 편집한 줄을 빨간색으로 표시했습니다. mypassword를 phpmyadmin 사용자에 대해 선택한 암호로 바꿉니다. 줄 앞의 //도 제거되었습니다!
ISPConfig 3.2를 설치한 후 다음과 같이 phpMyAdmin에 액세스할 수 있습니다.
nginx용 포트 8081의 ISPConfig 앱 가상 호스트는 phpMyAdmin 구성과 함께 제공되므로 http://server1.example.com:8081/phpmyadmin 또는 http://server1.example.com:8081/phpMyAdmin을 사용하여 phpMyAdmin에 액세스할 수 있습니다.
웹사이트에서 사용할 수 있는 /phpmyadmin 또는 /phpMyAdmin 별칭을 사용하려는 경우 nginx에는 전역 별칭(즉, 모든 가상 호스트에 대해 정의할 수 있는 별칭)이 없기 때문에 Apache보다 약간 더 복잡합니다. 따라서 phpMyAdmin에 액세스하려는 각 가상 호스트에 대해 이러한 별칭을 정의해야 합니다.
이렇게 하려면 나중에 ISPConfig에서 웹 사이트의 옵션 탭에 있는 nginx Directives 필드에 다음을 붙여넣습니다.
location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; }
가상 호스트에 http 대신 https를 사용하는 경우 fastcgi_param HTTPS on 행을 추가해야 합니다. 다음과 같이 phpMyAdmin 구성에:
location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; fastcgi_param HTTPS on; # <-- add this line fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; }
가상 호스트에 http와 https를 모두 사용하는 경우 $https 변수를 사용할 수 있습니다. nginx Directives 필드로 다시 이동하고 fastcgi_param 대신 HTTPS on; fastcgi_param HTTPS $https 행을 추가합니다. http 및 https 요청 모두에 대해 phpMyAdmin을 사용할 수 있습니다.
location /phpmyadmin { root /usr/share/; index index.php index.html index.htm; location ~ ^/phpmyadmin/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; fastcgi_param HTTPS $https; # <-- add this line fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /phpMyAdmin { rewrite ^/* /phpmyadmin last; }
11 Lets Encrypt 설치
ISPConfig는 이제 Lets Encrypt 클라이언트로 acme.sh를 사용하고 있습니다. 다음 명령을 사용하여 acme.sh를 설치합니다.
curl https://get.acme.sh | sh -s
12 우체부 설치
ISPConfig를 사용하면 Mailman 메일링 목록을 관리(생성/수정/삭제)할 수 있습니다. 이 기능을 사용하려면 다음과 같이 Mailman을 설치하십시오.
apt-get install mailman
하나 이상의 언어를 선택하십시오. 예:
지원 언어: <-- en(영어)
누락된 사이트 목록 <-- 확인Mailman을 시작하기 전에 mailman이라는 첫 번째 메일링 리스트를 만들어야 합니다.
newlist mailman
[이메일 보호됨]:~#
나중에 /etc/aliases를 엽니다...
nano /etc/aliases
... 그리고 다음 줄을 추가합니다.
[...] ## mailman mailing list mailman: "|/var/lib/mailman/mail/mailman post mailman" mailman-admin: "|/var/lib/mailman/mail/mailman admin mailman" mailman-bounces: "|/var/lib/mailman/mail/mailman bounces mailman" mailman-confirm: "|/var/lib/mailman/mail/mailman confirm mailman" mailman-join: "|/var/lib/mailman/mail/mailman join mailman" mailman-leave: "|/var/lib/mailman/mail/mailman leave mailman" mailman-owner: "|/var/lib/mailman/mail/mailman owner mailman" mailman-request: "|/var/lib/mailman/mail/mailman request mailman" mailman-subscribe: "|/var/lib/mailman/mail/mailman subscribe mailman" mailman-unsubscribe: "|/var/lib/mailman/mail/mailman unsubscribe mailman"
달리다
newaliases
나중에 Postfix를 다시 시작하십시오.
systemctl restart postfix
그런 다음 Mailman 데몬을 시작합니다.
systemctl restart mailman
ISPConfig 3을 설치한 후 다음과 같이 Mailman에 액세스할 수 있습니다.
nginx용 포트 8081의 ISPConfig 앱 가상 호스트는 Mailman 구성과 함께 제공되므로 http://server1.example.com:8081/cgi-bin/mailman/admin/
또는 http://server1.example을 사용할 수 있습니다. .com:8081/cgi-bin/mailman/listinfo/ 에서 Mailman에 액세스합니다. 웹 사이트에서 Mailman을 사용하려는 경우 nginx에는 전역 별칭(즉, 모든 가상 호스트에 대해 정의할 수 있는 별칭)이 없기 때문에 Apache보다 약간 더 복잡합니다. 따라서 Mailman에 액세스하려는 각 가상 호스트에 대해 이러한 별칭을 정의해야 합니다.
이렇게 하려면 ISPConfig에서 웹 사이트의 옵션 탭에 있는 nginx Directives 필드에 다음을 붙여넣습니다.
location /cgi-bin/mailman { root /usr/lib/; fastcgi_split_path_info (^/cgi-bin/mailman/[^/]*)(.*)$; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/fcgiwrap.socket; } location /images/mailman { alias /usr/share/images/mailman; } location /pipermail { alias /var/lib/mailman/archives/public; autoindex on; }
이는 가상 호스트에 대한 별칭 /cgi-bin/mailman/을 정의합니다. 즉, http://
/cgi-bin/mailman/admin/ 에 있는 목록의 Mailman 관리 인터페이스에 액세스할 수 있으며 메일링 리스트 사용자를 위한 웹 페이지는 http:// /cgi-bin/mailman/listinfo/ 에서 찾을 수 있습니다. http://
/pipermail에서 메일링 리스트 아카이브를 찾을 수 있습니다. 13 PureFTPd 및 할당량 설치
PureFTPd 및 할당량은 다음 명령으로 설치할 수 있습니다.
apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool
파일 편집 /etc/default/pure-ftpd-common...
nano /etc/default/pure-ftpd-common
... 시작 모드가 독립 실행형으로 설정되어 있는지 확인하고 VIRTUALCHROOT=true로 설정합니다.
[...] STANDALONE_OR_INETD=standalone [...] VIRTUALCHROOT=true [...]
이제 FTP 및 TLS 세션을 허용하도록 PureFTPd를 구성합니다. FTP는 모든 암호와 모든 데이터가 일반 텍스트로 전송되기 때문에 매우 안전하지 않은 프로토콜입니다. TLS를 사용하면 전체 통신을 암호화할 수 있으므로 FTP를 훨씬 더 안전하게 만들 수 있습니다.
FTP 및 TLS 세션을 허용하려면 다음을 실행하십시오.
echo 1 > /etc/pure-ftpd/conf/TLS
TLS를 사용하기 위해서는 SSL 인증서를 생성해야 합니다. /etc/ssl/private/에 생성하므로 먼저 해당 디렉토리를 생성합니다.
mkdir -p /etc/ssl/private/
그런 다음 다음과 같이 SSL 인증서를 생성할 수 있습니다.
openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem
국가 이름(2자리 코드) [AU]: <-- 국가 이름(예: "DE")을 입력하세요.
주 또는 도 이름(전체 이름) [Some-State]:<-- 국가 이름을 입력하세요. 시/도 이름.
지역 이름(예: 도시) []:<-- 도시를 입력하세요.
조직 이름(예: 회사) [Internet Widgits Pty Ltd]:<-- 조직 이름을 입력하세요( 예: 회사 이름).
조직 단위 이름(예: 섹션) []:<-- 조직 단위 이름(예: "IT 부서")을 입력합니다.
일반 이름(예: 귀하 name) []:<-- 시스템의 정규화된 도메인 이름을 입력합니다(예: "server1.example.com").
이메일 주소 []:<-- 이메일 주소를 입력합니다.SSL 인증서의 권한을 변경합니다.
chmod 600 /etc/ssl/private/pure-ftpd.pem
그런 다음 PureFTPd를 다시 시작합니다.
systemctl restart pure-ftpd-mysql
/etc/fstab을 편집합니다. 광산은 다음과 같습니다(마운트 지점 /이 있는 파티션에 ,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0을 추가했습니다).
nano /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=45576b38-39e8-4994-b8c1-ea4870e2e614 / ext4 errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0 1
# swap was on /dev/sda5 during installation
UUID=8bea0d1e-ec37-4b20-9976-4b7daaa3eb69 none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0할당량을 활성화하려면 다음 명령을 실행합니다.
mount -o remount /
quotacheck -avugm
quotaon -avug14 BIND DNS 서버 설치
BIND는 다음과 같이 설치할 수 있습니다.
apt-get install bind9 dnsutils
서버가 가상 머신인 경우 DNSSEC 서명을 위해 더 높은 엔트로피를 얻기 위해 haveged 데몬을 설치하는 것이 좋습니다. 가상 서버가 아닌 서버에도 hasged를 설치할 수 있습니다. 아프지 않아야 합니다.
apt-get -y install haveged
systemctl enable haveged
systemctl start haveged해당 주제에 대한 설명은 여기에서 찾을 수 있습니다.
15 Webalizer, AWStats 및 GoAccess 설치
Webalizer 및 AWStats는 다음과 같이 설치할 수 있습니다.
apt-get install webalizer awstats geoip-database libtimedate-perl libclass-dbi-mysql-perl
나중에 /etc/cron.d/awstats를 엽니다...
nano /etc/cron.d/awstats
... 해당 파일의 모든 내용을 주석 처리합니다.
#MAILTO=root #*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh # Generate static reports: #10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh
GoAccess 리포지토리에서 직접 최신 GoAccess 버전 설치:
echo "deb https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key --keyring /etc/apt/trusted.gpg.d/goaccess.gpg add -
apt-get update
apt-get install goaccess16 Jailkit 설치
Jailkit은 SSH 사용자를 chroot하려는 경우에만 필요합니다. 다음과 같이 설치할 수 있습니다(중요: Jailkit은 ISPConfig 전에 설치해야 합니다. 이후에는 설치할 수 없습니다!).
apt-get install build-essential autoconf automake libtool flex bison debhelper binutils
cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.20.tar.gz
tar xvfz jailkit-2.20.tar.gz
cd jailkit-2.20
echo 5 > debian/compat
./debian/rules binary이제 다음과 같이 Jailkit .deb 패키지를 설치할 수 있습니다.
cd ..
dpkg -i jailkit_2.20-1_*.deb
rm -rf jailkit-2.20*17 Fail2ban 및 UFW 방화벽 설치
이는 선택사항이지만 ISPConfig 모니터가 로그를 표시하려고 하기 때문에 권장됩니다.
apt-get install fail2ban
fail2ban이 PureFTPd 및 Dovecot을 모니터링하도록 하려면 /etc/fail2ban/jail.local 파일을 만듭니다.
nano /etc/fail2ban/jail.local
[pure-ftpd]
enabled = true
port = ftp
filter = pure-ftpd
logpath = /var/log/syslog
maxretry = 3
[dovecot]
enabled = true
filter = dovecot
logpath = /var/log/mail.log
maxretry = 5
[postfix-sasl]
enabled = true
port = smtp
filter = postfix[mode=auth]
logpath = /var/log/mail.log
maxretry = 3나중에 fail2ban을 다시 시작하십시오.
systemctl restart fail2ban
UFW 방화벽을 설치하려면 다음 apt 명령을 실행하십시오.
apt-get install ufw
18 RoundCube 설치
다음 명령으로 RoundCube를 설치합니다.
apt-get install roundcube roundcube-core roundcube-mysql roundcube-plugins
설치 프로그램은 다음과 같은 질문을 합니다.
Configure database for roundcube with dbconfig.common? <-- yes
MySQL application password for roundcube: <-- press enter
Password of the databases administrative user: <-- enter the MySQL root password here.그런 다음 RoundCube /etc/roundcube/config.inc.php 파일을 편집하고 몇 가지 설정을 조정합니다.
nano /etc/roundcube/config.inc.php
default_host를 localhost로 설정하고 smtp_server를 설정합니다.
$config['default_host'] = 'localhost';
$config['smtp_server'] = 'localhost';
$config['smtp_port'] = 25;ISPConfig는 roundcube에서도 작동하는 squirrelmail용 nginx 앱 vhost에 몇 가지 구성을 가지고 있습니다. 다음과 같이 활성화합니다.
ln -s /usr/share/roundcube /usr/share/squirrelmail
19 ISPConfig 3 설치
ISPConfig 설치를 시작하기 전에 Apache가 중지되었는지 확인하십시오(설치되어 있는 경우 설치된 패키지 중 일부가 사용자 모르게 Apache를 종속 항목으로 설치했을 수 있음). 시스템에 Apache2가 이미 설치되어 있으면 지금 중지하십시오...
systemctl stop apache2
... Apache 시스템 시작 링크를 제거합니다.
update-rc.d -f apache2 remove
nginx가 실행 중인지 확인합니다.
systemctl start nginx
(Apache와 nginx가 모두 설치되어 있는 경우 설치 프로그램에서 Apache와 nginx 감지 중 어느 것을 사용할지 묻습니다. ISPConfig에 사용할 서버 선택: (apache,nginx) [apache]:
nginx를 입력합니다. Apache 또는 nginx만 설치된 경우 설치 프로그램에서 자동으로 감지하고 질문하지 않습니다.)
최신 릴리스 버전에서 ISPConfig 3.2를 설치하려면 다음과 같이 하십시오.
cd /tmp
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
tar xfz ISPConfig-3-stable.tar.gz
cd ispconfig3_install/install/다음 단계는 실행하는 것입니다.
php -q install.php
그러면 ISPConfig 3 설치 프로그램이 시작됩니다. 설치 프로그램은 Postfix, Nginx, Dovecot 등과 같은 모든 서비스를 구성합니다.
# php -q install.php
--------------------------------------------------------------------------------
_____ ___________ _____ __ _ ____
|_ _/ ___| ___ \ / __ \ / _(_) /__ \
| | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ /
| | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ |
_| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/
__/ |
|___/
--------------------------------------------------------------------------------
>> Initial configurationOperating System: Debian 10.0 (Buster) or compatible
Following will be a few questions for primary configuration so be careful.
Default values are in [brackets] and can be accepted with <ENTER>.
Tap in "quit" (without the quotes) to stop the installer.
Select language (en,de) [en]: <-- Hit EnterInstallation mode (standard,expert) [standard]: <-- Hit Enter
Full qualified hostname (FQDN) of the server, eg server1.domain.tld [server1.canomi.com]: <-- Hit Enter
MySQL server hostname [localhost]: <-- Hit Enter
MySQL server port [3306]: <-- Hit Enter
MySQL root username [root]: <-- Hit Enter
MySQL root password []: <-- Enter your MySQL root password
MySQL database to create [dbispconfig]: <-- Hit Enter
MySQL charset [utf8]: <-- Hit Enter
Apache and nginx detected. Select server to use for ISPConfig: (apache,nginx) [apache]: <-- nginx
Configuring Postgrey
Configuring Postfix
Generating a 4096 bit RSA private key
.......................................................................++
........................................................................................................................................++
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <-- Enter 2 letter country code
State or Province Name (full name) [Some-State]: <-- Enter the name of the state
Locality Name (eg, city) []: <-- Enter your city
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter company name or press enter
Organizational Unit Name (eg, section) []: <-- Hit Enter
Common Name (e.g. server FQDN or YOUR name) []: <-- Enter the server hostname, in my case: server1.example.com
Email Address []: <-- Hit Enter
Configuring Mailman
Configuring Dovecot
Configuring Spamassassin
Configuring Amavisd
Configuring Getmail
Configuring BIND
Configuring Jailkit
Configuring Pureftpd
Configuring Nginx
Configuring vlogger
[INFO] service Metronome XMPP Server not detectedConfiguring UFW Firewall
Configuring Fail2ban
[INFO] service OpenVZ not detected
Configuring Apps vhost
Installing ISPConfig
ISPConfig Port [8080]:Admin password [admin]: <-- Enter desired ISPConfig admin user password here
Do you want a secure (SSL) connection to the ISPConfig web interface (y,n) [y]: <-- Hit Enter
Generating RSA private key, 4096 bit long modulus
.......................++
................................................................................................................................++
e is 65537 (0x10001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <-- Enter 2 letter country code
State or Province Name (full name) [Some-State]: <-- Enter the name of the state
Locality Name (eg, city) []: <-- Enter your city
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter company name or press enter
Organizational Unit Name (eg, section) []: <-- Hit Enter
Common Name (e.g. server FQDN or YOUR name) []: <-- Enter the server hostname, in my case: server1.example.com
Email Address []: <-- Hit EnterPlease enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: <-- Hit Enter
An optional company name []: <-- Hit Enter
writing RSA key
Configuring DBServer
Installing ISPConfig crontab
no crontab for root
no crontab for getmail
Detect IP addresses
Restarting services ...
Installation completed.설치 프로그램은 모든 기본 서비스를 자동으로 구성하므로 수동 구성이 필요하지 않습니다.
그런 다음 http(s)://server1.example.com:8080/ 또는 http(s)://192.168.1.100:8080/에서 ISPConfig 3에 액세스할 수 있습니다(http 또는 https는 설치 중에 선택한 항목에 따라 다름). 사용자 이름 admin과 비밀번호 admin으로 로그인합니다(처음 로그인한 후 기본 비밀번호를 변경해야 함).
마지막으로 RoundCube 설치의 일부 권한을 수정합니다.
chown root:ispapps /etc/roundcube/debian-db.php chmod 640 /etc/roundcube/debian-db.php chown root:ispapps /etc/roundcube/config.inc.php chmod 640 /etc/roundcube/config.inc.php chown -R ispapps:adm /var/log/roundcube chmod -R 750 /var/log/roundcube chown -R ispapps:ispapps /var/lib/roundcube/temp chmod -R 750 /var/lib/roundcube/temp
이제 시스템을 사용할 준비가 되었습니다.
RoundCube Webmail을 ISPConfig와 통합하기 위한 일부 플러그인이 있습니다. 여기에서 ISPConfig RoundCube 플러그인 설치 지침을 살펴보십시오.
20.1 ISPConfig 3 매뉴얼
ISPConfig 3 사용 방법을 알아보려면 ISPConfig 3 설명서를 다운로드하는 것이 좋습니다.
300페이지가 넘는 페이지에서 ISPConfig(관리자, 리셀러, 클라이언트)의 개념을 다루고, ISPConfig 3 설치 및 업데이트 방법을 설명하고, 유효한 입력의 예와 함께 ISPConfig의 모든 양식 및 양식 필드에 대한 참조를 포함하고, 자습서를 제공합니다. ISPConfig 3의 가장 일반적인 작업에 대한 것입니다. 또한 서버를 더 안전하게 만드는 방법을 설명하고 마지막에 문제 해결 섹션이 함께 제공됩니다.
21 이 튜토리얼의 가상 머신 이미지 다운로드
이 튜토리얼은 VMWare 및 Virtualbox와 호환되는 ovf/ova 형식의 가상 머신 이미지를 사용할 준비가 된 상태로 제공됩니다. 가상 머신 이미지는 다음 로그인 세부 정보를 사용합니다.
SSH/쉘 로그인
사용자 이름: administrator
비밀번호: howtoforge사용자 이름: root
비밀번호: howtoforgeISPConfig 로그인
사용자 이름: admin
비밀번호: howtoforgeMySQL 로그인
사용자 이름: root
비밀번호: howtoforgeVM의 IP는 192.168.0.100이며 /etc/network/interfaces 파일에서 변경할 수 있습니다. 위의 모든 암호를 변경하여 가상 머신을 보호하십시오.
22 링크
- 데비안: http://www.debian.org/
- ISP구성: http://www.ispconfig.org/