Let's Encrypt SSL을 사용하여 CentOS 7에 DokuWiki를 설치합니다.
이 가이드는 nginx 뒤에 DokuWiki를 설치하고 CentOS 7 Linux에서 SSL 인증서를 암호화하는 단계를 안내합니다. 하지만 설치를 시작하기 전에 DokuWiki를 설정하기 전에 몇 가지 전제 조건을 수행해야 하는 새로 프로비저닝된 CentOS 7 Linux 서버가 있다고 가정하겠습니다.
서버 호스트 이름을 설정합니다. DNS 서버에서 사용되는 FQDN에 IP 주소를 매핑하는 것이 좋습니다.
sudo hostnamectl set-hostname wiki.mydomain.com또한 올바른 시간대 설정을 고려하십시오.
sudo timedatectl set-timezone Region/Country
#Example:
sudo timedatectl set-timezone Africa/NairobiNTP 서버를 사용하여 시간 동기화
sudo yum -y install chrony
sudo systemctl enable --now chronyd
sudo chronyc sources1단계: 시스템 업데이트 및 개발 도구 설치
모든 시스템 패키지가 업데이트되었는지 확인하는 것이 좋습니다.
sudo yum -y update
sudo yum -y install git vim bash-completion curl wget unzip tar
커널과 같은 새로운 변경 사항을 적용하려면 서버를 재부팅하세요.
sudo reboot2단계: PHP 7.x용 EPEL 및 Remi 저장소 추가
재부팅 후 서버가 가동되면 Nginx에서 사용하는 php fpm을 포함하여 필요한 모든 PHP 모듈 설치를 진행하세요. 하지만 먼저 epel 및 remi 저장소를 시스템에 추가해야 합니다.
sudo yum -y install epel-release yum-utils
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum clean all && sudo yum makecache fast
sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php743단계: PHP 및 필수 확장 프로그램 설치
다음 명령을 실행하여 PHP 7.x를 설치하십시오.
sudo yum -y install php-cli php-fpm php-mysql php-zip php-ldap php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath이는 DokuWiki에 필요한 모든 모듈을 제공해야 합니다. PHP 버전을 확인하세요:
$ php -v
PHP 7.4.28 (cli) (built: Feb 15 2022 13:23:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies4단계: DokuWiki를 다운로드하고 압축을 풉니다.
DokuWiki 버전을 다운로드하기 전에 Github 릴리스 페이지에서 최신 안정 릴리스를 확인하세요.
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgztar를 사용하여 DokuWiki 아카이브 추출
tar xvf dokuwiki-stable.tgz
sudo mkdir -p /var/www/html/
sudo mv dokuwiki-*/ /var/www/html/dokuwiki5단계: certbot 설치
certbot을 사용하여 SSL 인증서를 요청하겠습니다. 아래와 같이 설치하세요.
sudo yum -y install epel-release
sudo yum -y install vim certbot python2-certbot-nginx다운로드한 후 활성 방화벽 서비스가 있는 경우 방화벽에서 http 및 https 포트를 엽니다.
sudo firewall-cmd --add-service {http,https} --permanent6단계: Nginx 웹 서버 구성(https가 아님)
nginx 웹 서버 설치
sudo yum -y install nginx새 구성 파일을 만듭니다.
sudo vim /etc/nginx/conf.d/dokuwiki.conf
HTTPS 없이 구성 블록을 추가하고 wiki.mydomain.com을 실제 도메인 이름으로 바꾸겠습니다.
server {
listen 80;
server_name wiki.mydomain.com;
root /var/www/html/;
access_log /var/log/nginx/dokuwiki.access.log;
error_log /var/log/nginx/dokuwiki.error.log;
index index.html index.php doku.php;
location / {
try_files $uri $uri/ @dokuwiki;
}
location @dokuwiki {
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
rewrite ^/(.*) /doku.php?id=$1 last;
}
location ~ /(data|conf|bin|inc)/ {
deny all;
}
location ~* \.(css|js|gif|jpe?g|png)$ {
expires 1M;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
}Nginx 구성 구문을 확인하세요.
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful데이터 디렉터리 권한을 설정합니다.
sudo chown -R nginx:nginx /var/www/html/SELinux가 구성 라벨을 올바르게 적용하는 경우:
sudo yum -y install policycoreutils-python
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html(/.*)?"
sudo restorecon -Rvv /var/www/htmlhttp://wiki.mydomain.com에서 DokuWiki 웹 포털에 접속하세요.
php-fpm 구성 및 nginx/php-fpm 시작
이제 nginx가 구성되었으므로 php-fpm도 구성해 보겠습니다. 파일을 엽니다:
sudo vim /etc/php-fpm.d/www.conf지정된 대로 파일에 대해 아래 매개변수를 구성합니다.
user = nginx
group = nginx
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660nginx 및 php-fpm 서비스를 시작하고 활성화합니다.
sudo systemctl restart php-fpm nginx
sudo systemctl enable php-fpm nginx서비스 상태를 확인하고 http://wiki.mydomain/install.php에서 DokuWiki 웹 인터페이스에 접속하세요.
7단계: Let’s Encrypt SSL 구성(선택 사항)
Let's Encrypt SSL 인증서 요청
sudo certbot --nginx -d wiki.mydomain.com
샘플 출력:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Requesting a certificate for wiki.mydomain.com
Deploying Certificate to VirtualHost /etc/nginx/conf.d/dokuwiki.conf
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/dokuwiki.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://wiki.mydomain.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/wiki.mydomain.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/wiki.mydomain.com/privkey.pem
Your certificate will expire on 2022-07-01. 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-le8단계: CentOS 7에서 DokuWiki 구성
http://wiki.mydomain/install.php 링크를 열어 DokuWiki 구성을 시작하면 아래와 같은 설치 페이지가 나타납니다.
관리자 세부정보를 제공하고 초기 ACL 정책에서 다음 중 하나의 정책을 선택합니다.
- 위키 열기 - 누구나 사용할 수 있습니다.
- 공개 위키 - 등록된 사용자가 모두 읽고 업로드하고 편집할 수 있습니다.
- 비공개 위키 - 등록된 사용자만 접근 가능
사용자가 직접 등록하도록 허용할지 확인하세요.
완료되면 저장을 클릭합니다. 이제 위키 페이지가 준비되었습니다.
DokuWiki 홈페이지로 이동하려면 '새 DokuWiki' 를 클릭하세요.
9단계: DokuWiki에 사용자 추가하기
'닫힌 위키 | 공개' ACL 정책으로 설정하면 편집할 수 있는 로그인 페이지가 제공됩니다. 시스템에 다른 사용자를 추가하려면 이전에 만든 관리자 계정으로 로그인하세요.
페이지 상단의 '관리자' 아이콘을 클릭하면 관리 페이지로 이동됩니다.
사용자 추가 페이지를 보려면 '사용자 관리자' 를 클릭하세요.
사용자 세부정보를 추가하고 '추가' 버튼을 클릭하세요. 사용자를 추가한 후 '액세스 제어 목록 관리' 페이지에서 ACL을 할당할 수 있습니다.
주어진 권한 중에서 선택하세요.
관련 기사
- CentOS 7에서 DokuWiki를 설치하고 구성하는 방법
- Let's Encrypt SSL을 사용하여 Ubuntu에 DokuWiki를 설치합니다.





