Debian 11에서 Let's Encrypt SSL을 사용하여 DokuWiki를 설치하는 방법
DokuWiki는 PHP로 작성된 무료 오픈 소스의 강력한 Wiki 소프트웨어 애플리케이션입니다. 데이터베이스를 사용하는 대신 파일을 사용하여 데이터를 저장합니다. 간단하고 가벼우며 웹 브라우저에서 웹사이트를 만들고 편집할 수 있습니다. 이는 웹사이트를 쉽게 확장하고 최적화할 수 있는 많은 기능을 제공합니다. 깔끔하고 읽기 쉬운 구문, 유지 관리 용이성, 백업 및 통합으로 인해 많은 사용자가 사용합니다.
이 튜토리얼에서는 Apache와 함께 DokuWiki를 설치하는 방법과 Debian 11에서 SSL을 암호화하는 방법을 보여 드리겠습니다.
전제조건
- Ubuntu 20.04를 실행하는 서버.
- 서버 IP를 가리키는 유효한 도메인 이름입니다.
- 루트 비밀번호는 서버에 구성되어 있습니다.
시작하기
시작하기 전에 시스템 패키지를 최신 버전으로 업데이트하는 것이 좋습니다. 다음 명령을 실행하여 업데이트할 수 있습니다.
apt-get update -y모든 패키지가 업데이트되면 다음 단계로 진행할 수 있습니다.
아파치와 PHP를 설치하세요
DokuWiki는 Apache 또는 Nginx에서 실행되며 PHP 언어로 작성되었습니다. 따라서 Apache, PHP 및 기타 필수 확장 기능을 서버에 설치해야 합니다. 다음 명령을 실행하여 설치할 수 있습니다.
apt-get install apache2 php php-gd php-xml php-json -y
모든 패키지가 설치되면 Apache 서비스를 시작하고 시스템 재부팅 시 시작되도록 활성화합니다.
systemctl start apache2
systemctl enable apache2완료되면 다음 단계로 진행할 수 있습니다.
DokuWiki 설치
먼저 DokuWiki 다운로드 페이지로 이동하여 다음 명령을 사용하여 DokuWiki 최신 버전을 다운로드하세요.
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz다운로드가 완료되면 Apache 웹 루트 디렉터리 내에 DokuWiki용 디렉터리를 만듭니다.
mkdir /var/www/html/dokuwiki다음으로, 다음 명령을 사용하여 다운로드한 파일을 DokuWiki 디렉토리에 추출하세요:
tar -xvzf dokuwiki-stable.tgz -C /var/www/html/dokuwiki/ --strip-components=1그런 다음 다음 명령을 사용하여 필요한 일부 파일을 복사합니다.
cp /var/www/html/dokuwiki/.htaccess{.dist,}다음으로, DokuWiki 디렉토리에 적절한 소유권을 설정하세요:
chown -R www-data:www-data /var/www/html/dokuwiki완료되면 다음 단계로 진행할 수 있습니다.
DokuWiki용 Apache 가상 호스트 생성
다음으로 인터넷에서 DokuWiki를 호스팅하기 위한 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령을 사용하여 생성할 수 있습니다:
nano /etc/apache2/sites-available/dokuwiki.conf다음 줄을 추가합니다.
<VirtualHost *:80>
ServerName dokuwiki.example.com
DocumentRoot /var/www/html/dokuwiki
<Directory ~ "/var/www/html/dokuwiki/(bin/|conf/|data/|inc/)">
<IfModule mod_authz_core.c>
AllowOverride All
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
</IfModule>
</Directory>
ErrorLog /var/log/apache2/dokuwiki_error.log
CustomLog /var/log/apache2/dokuwiki_access.log combined
</VirtualHost>
파일을 저장하고 닫은 후 다음 명령을 사용하여 가상 호스트 구성 파일을 활성화합니다.
a2ensite dokuwiki.conf그런 다음 Apache를 다시 로드하여 변경 사항을 적용합니다.
systemctl reload apache2다음 명령을 사용하여 Apache 상태를 확인할 수도 있습니다.
systemctl status apache2다음과 같은 결과가 출력됩니다.
? apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-10-24 04:01:29 UTC; 9min ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 27698 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
Tasks: 77 (limit: 4691)
Memory: 12.5M
CGroup: /system.slice/apache2.service
??21346 /usr/sbin/apache2 -k start
??27703 Passenger watchdog
??27706 Passenger core
??27711 Passenger ust-router
??27729 /usr/sbin/apache2 -k start
??27730 /usr/sbin/apache2 -k start
Let's Encrypt SSL로 DokuWiki를 보호하세요
Apache를 구성한 후에는 Let's Encrypt SSL 인증서를 사용하여 위키 사이트를 보호하는 것이 좋습니다. 그렇게 하려면 시스템에 Certbot 클라이언트를 설치해야 합니다. Certbot은 EFF, Mozilla 등이 시작한 공개 인증 기관인 Let's Encrypt에서 인증서를 가져와 웹 서버에 배포하는 사용하기 쉬운 클라이언트입니다. Certbot Let's Encrypt 클라이언트를 사용하면 도메인에 대한 SSL 인증서를 쉽게 다운로드, 설치 및 갱신할 수 있습니다.
다음 명령을 사용하여 Certbot을 설치할 수 있습니다.
apt-get install certbot python3-certbot-apache -yCertbot 클라이언트가 성공적으로 설치되면 다음 명령을 실행하여 웹 사이트에 Let's Encrypt SSL을 설치합니다.
certbot --apache -d dokuwiki.example.com아래와 같이 유효한 이메일을 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for dokuwiki.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/dokuwiki-le-ssl.conf
그런 다음, HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택하거나 다음 출력에 표시된 대로 모든 트래픽을 보안 HTTPS 액세스로 리디렉션하도록 Nginx를 구성합니다.
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
2를 입력하고 Enter를 눌러 프로세스를 시작합니다. 설치가 완료되면 다음과 같은 출력이 표시됩니다.
Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/dokuwiki.conf to ssl vhost in /etc/apache2/sites-available/dokuwiki-le-ssl.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://dokuwiki.example.com
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=dokuwiki.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/dokuwiki.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/dokuwiki.example.com/privkey.pem
Your cert will expire on 2021-01-25. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
이 시점에서 귀하의 Dokuwiki 사이트는 Let's Encrypt SSL로 보호됩니다. 이제 HTTPS 프로토콜을 사용하여 안전하게 사이트에 액세스할 수 있습니다.
Let's Encrypt SSL 인증서 자동 갱신 설정
기본적으로 Let’s Encrypt 인증서는 90일 동안 유효합니다. 따라서 SSL 인증서를 자동 갱신하려면 cron 작업을 설정해야 합니다. 매주 또는 매일 실행되는 크론 작업을 생성하는 것이 안전합니다.
SSL 인증서를 수동으로 갱신하려면 다음 명령을 실행하십시오.
certbot renew --dry-run다음 파일을 편집하여 매일 오전 10시에 SSL 인증서를 자동 갱신하도록 크론 작업을 설정할 수 있습니다.
crontab -e다음 줄을 추가합니다.
00 10 * * * root /usr/bin/certbot renew >/dev/null 2>&1
완료되면 파일을 저장하고 닫습니다.
DokuWiki에 접속하세요
이제 웹 브라우저를 열고 https://dokuwiki.example.com/install.php URL을 입력하세요. DokuWiki 설치 화면이 나타납니다:
위키 이름, 관리자 사용자 이름, 비밀번호, 이메일을 제공하고 정책을 선택한 후 저장 버튼을 클릭하세요. 다음 페이지로 리디렉션됩니다.
"새 DokuWiki"를 클릭하세요. 다음 화면이 표시됩니다.
로그인 버튼을 클릭하세요. 아래와 같이 DokuWiki 로그인 화면으로 리디렉션됩니다:
관리자 사용자 이름과 비밀번호를 입력하고 로그인 버튼을 클릭하세요. 다음 화면에서 DokuWiki 대시보드를 볼 수 있습니다:
결론
축하해요! DokuWiki를 성공적으로 설치하고 Debian 11에서 Let's Encrypt SSL로 보안을 설정했습니다. 이제 DokuWiki를 사용하여 첫 번째 웹사이트 만들기를 시작할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.




