웹사이트 검색

Ubuntu 20.04 LTS에 DokuWiki를 설치하는 방법


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • 우분투 18.04(바이오닉 비버)

이 페이지에서

  1. 전제 조건
  2. 시스템 패키지 업데이트
  3. Apache 및 PHP 설치
  4. DokuWiki 다운로드
  5. DokuWiki용 Apache 구성
  6. Lets Encrypt SSL로 DokuWiki 보안
  7. DokuWiki에 액세스
  8. Lets Encrypt SSL 인증서 자동 갱신 설정
  9. 결론

DokuWiki는 무료 오픈 소스이며 PHP로 작성된 가장 다재다능한 위키 애플리케이션입니다. 간단한 파일 형식을 사용하여 데이터를 저장하는 간단하고 가벼우므로 데이터베이스가 필요하지 않습니다. 깨끗하고 읽기 쉬운 구문으로 유명하며 많은 고급 기능을 사용하여 쉽게 확장하고 최적화할 수 있습니다. 콘텐츠를 서버에 업로드하기만 하면 개인 또는 비즈니스 웹사이트를 만들 수 있습니다. WYSIWYG 지원, SEO 친화적, 내장 액세스 제어, 인증 커넥터, 유연한 CSS 프레임워크 등을 포함한 다양한 기능 세트가 함께 제공됩니다.

이 튜토리얼에서는 Ubuntu 20.04에서 Apache 및 Letsencrypt SSL 인증서와 함께 DokuWiki를 설치하는 방법을 보여줍니다.

전제 조건

  • Ubuntu 20.04를 실행하는 서버.\n
  • 서버를 가리키는 유효한 도메인 이름입니다.\n
  • 서버에 루트 암호가 구성되어 있습니다.\n

시스템 패키지 업데이트

시작하기 전에 시스템 패키지를 최신 버전으로 업데이트하는 것이 좋습니다. 다음 명령으로 수행할 수 있습니다.

apt-get update -y
apt-get upgrade -y

시스템이 업데이트되면 시스템을 다시 시작하여 변경 사항을 적용하십시오.

아파치와 PHP 설치

DokuWiki는 PHP로 작성되었으며 웹서버에서 실행됩니다. 따라서 Apache 웹 서버, PHP 및 기타 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-rc.tgz

다운로드가 완료되면 Apache 웹 루트 디렉터리 내에 DokuWiki 디렉터리를 만들고 DokuWiki를 추출합니다.

mkdir /var/www/html/dokuwiki
tar -xvzf dokuwiki-rc.tgz -C /var/www/html/dokuwiki/ --strip-components=1

그런 다음 다음 명령을 사용하여 샘플 .htaccess 파일을 복사합니다.

cp /var/www/html/dokuwiki/.htaccess{.dist,}

다음으로 dokuwiki의 소유권을 www-data로 변경합니다.

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.linuxbuz.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>

완료되면 파일을 저장하고 닫습니다. 그런 다음 DokuWiki 사이트를 활성화하고 다음 명령을 사용하여 Apache 서비스를 다시 로드합니다.

a2ensite dokuwiki.conf
systemctl reload apache2

이 시점에서 Apache 웹 서버는 DokuWiki 사이트를 제공하도록 구성됩니다. 이제 웹 사이트에 Lets Encrypt SSL 설치를 진행할 수 있습니다.

Lets Encrypt SSL로 DokuWiki 보호

먼저 시스템에 Certbot 클라이언트를 설치해야 합니다. Certbot은 EFF, Mozilla 등에서 시작한 개방형 인증 기관인 Lets Encrypt에서 인증서를 가져와서 웹 서버에 배포하는 사용하기 쉬운 클라이언트입니다. Certbot Lets Encrypt 클라이언트를 사용하면 도메인의 SSL 인증서를 쉽게 다운로드, 설치 및 갱신할 수 있습니다.

다음 명령을 사용하여 Certbot을 설치할 수 있습니다.

apt-get install certbot python3-certbot-apache -y

Certbot 클라이언트가 성공적으로 설치되면 다음 명령을 실행하여 웹사이트에 Lets Encrypt SSL을 설치합니다.

certbot --apache -d dokuwiki.linuxbuz.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): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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.linuxbuz.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.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=dokuwiki.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/dokuwiki.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/dokuwiki.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-09-05. 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 사이트는 Lets Encrypt SSL로 보호됩니다. 이제 HTTPS 프로토콜을 사용하여 안전하게 사이트에 액세스할 수 있습니다.

DokuWiki에 액세스

이제 웹 브라우저를 열고 URL https://dokuwiki.linuxbuz.com/install.php를 입력하십시오. DokuWiki 설치 화면이 나타납니다:

위키 이름, 관리자 사용자 이름, 암호, 이메일을 제공하고 정책을 선택한 다음 저장 버튼을 클릭합니다. 다음 페이지로 리디렉션됩니다.

"당신은 새로운 DokuWiki"를 클릭합니다. 다음 화면이 표시됩니다.

로그인 버튼을 클릭합니다. 아래와 같이 DokuWiki 로그인 화면으로 리디렉션됩니다.

관리자 사용자 이름, 암호를 제공하고 로그인 버튼을 클릭합니다. 다음 화면에서 DokuWiki 대시보드를 볼 수 있습니다.

Lets Encrypt SSL 인증서 자동 갱신 설정

기본적으로 Let’s Encrypt 인증서는 90일 동안 유효합니다. 따라서 SSL 인증서를 자동 갱신하려면 cron 작업을 설정해야 합니다. 매주 또는 매일 실행되는 cron 작업을 만드는 것이 안전합니다.

SSL 인증서를 수동으로 갱신하려면 다음 명령을 실행하십시오.

certbot renew --dry-run

다음 파일을 편집하여 매일 오전 10시에 SSL 인증서를 자동 갱신하도록 cron 작업을 설정할 수 있습니다.

crontab -e

다음 줄을 추가합니다.

00 10 * * *   root /usr/bin/certbot renew >/dev/null 2>&1

완료되면 파일을 저장하고 닫습니다.

결론

축하합니다! DokuWiki를 성공적으로 설치하고 Ubuntu 20.04에서 Lets Encrypt SSL로 보호했습니다. 테마, 플러그인 및 템플릿을 사용하여 DokuWiki를 확장할 수도 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.