웹사이트 검색

Apache로 Tiki Wiki를 설치하고 Debian 10에서 SSL을 암호화하는 방법


이 페이지에서

  1. 요구 사항\n
  2. 시작하기\n
  3. LAMP 서버 설치
  4. TikiWiki용 데이터베이스 생성
  5. 티키위키 다운로드
  6. TikiWiki용 Apache 구성
  7. TikiWiki 웹 인터페이스에 액세스
  8. Let's Encrypt로 TikiWiki 보안

TikiWiki는 PHP 언어로 작성된 무료 오픈 소스 콘텐츠 관리 시스템입니다. 매우 강력하고 모든 기능을 갖추고 있으며 웹 사이트, 위키, 웹 응용 프로그램, 지식 기반, 포털, 이미지 갤러리 등을 만드는 데 사용할 수 있습니다. TikiWiki는 콘텐츠 생성 및 관리 도구, 커뮤니케이션 도구, 구성 및 관리 도구, 콘텐츠 구성 도구 및 탐색 도구의 네 가지 주요 구성 요소로 구성됩니다. 이를 통해 콘텐츠를 생성 및 관리하고 사이트를 구성할 수 있습니다. TikiWiki는 포럼, 블로그, 지도, 작업 공간, 슬라이드쇼, 쇼핑 카트, 버그 및 문제 추적기, 다국어, 파일 및 이미지 갤러리, 이벤트 등을 포함한 풍부한 기능 세트와 함께 제공됩니다.

이 튜토리얼에서는 Debian 10에 TikiWiki CMS를 설치하는 방법을 배웁니다.

요구 사항

  • Debian 10을 실행하는 서버.\n
  • 루트 암호는 서버에 설정됩니다.\n

시작하기

시작하기 전에 시스템을 최신 버전으로 업데이트해야 합니다. 다음 명령을 실행하여 이를 수행할 수 있습니다.

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

서버가 업데이트되면 서버를 다시 시작하여 변경 사항을 적용하십시오.

램프 서버 설치

TikiWiki는 PHP 언어로 작성된 Apache/Nginx 웹 서버에서 실행되며 MariaDB/MySQL을 사용하여 데이터를 저장합니다. 따라서 Apache, MariaDB, PHP 및 기타 필요한 확장을 서버에 설치해야 합니다. 먼저 다음 명령을 사용하여 Apache 및 MariaDB 서버를 설치합니다.

apt-get install apache2 mariadb-server unzip -y

기본적으로 Debian 10은 PHP 버전 7.3과 함께 제공됩니다. 그러나 티키위키는 PHP 7.3을 지원하지 않습니다. 따라서 PHP 7.2 및 기타 필요한 확장을 설치해야 합니다.

SURY 리포지토리를 추가하려면 먼저 다음 명령을 사용하여 GPG 키를 다운로드합니다.

wget https://packages.sury.org/php/apt.gpg
apt-key add apt.gpg

다음으로 다음 명령을 사용하여 APT에 SURY 리포지토리를 추가합니다.

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list

다음으로 다음 명령을 사용하여 리포지토리를 업데이트하고 필요한 모든 확장과 함께 PHP7.2를 설치합니다.

apt-get update -y
apt-get install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-sqlite3 php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip -y

PHP7.2를 설치한 후 php.ini 파일을 열고 일부 설정을 조정합니다.

nano /etc/php/7.2/apache2/php.ini

다음 줄을 추가합니다.

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Asia/Kolkata

완료되면 파일을 저장하고 닫습니다. 그런 다음 다음 단계를 진행합니다.

티키위키용 데이터베이스 생성

기본적으로 MariaDB는 보안되지 않습니다. 따라서 먼저 보안을 유지해야 합니다. 다음 스크립트를 사용하여 보안을 유지할 수 있습니다.

mysql_secure_installation

아래와 같이 모든 질문에 답해야 합니다.

    Enter current password for root (enter for none):
    Set root password? [Y/n]: N
    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

MariaDB가 보호되면 MariaDB 셸에 로그인합니다.

mysql -u root -p

프롬프트가 표시되면 루트 암호를 제공하고 다음 명령을 사용하여 TikiWiki에 대한 데이터베이스와 사용자를 생성하십시오:

MariaDB [(none)]> CREATE DATABASE tikidb;
MariaDB [(none)]> CREATE USER 'tiki'@'localhost' IDENTIFIED BY 'password';

다음으로, 다음 명령을 사용하여 TikiWiki 데이터베이스에 모든 권한을 부여하십시오:

MariaDB [(none)]> GRANT ALL ON tikidb.* TO 'tiki'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

그런 다음 권한을 플러시하고 다음 명령을 사용하여 MariaDB 셸을 종료합니다.

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

완료되면 다음 단계로 진행할 수 있습니다.

티키위키 다운로드

먼저 Sourceforge 웹사이트에서 최신 버전의 TikiWiki를 다운로드해야 합니다. 다음 명령으로 다운로드할 수 있습니다.

cd /var/www/html/
wget https://sourceforge.net/projects/tikiwiki/files/latest/download -O tikiwiki.zip

다운로드가 완료되면 다음 명령을 사용하여 다운로드한 파일의 압축을 풉니다.

unzip tikiwiki.zip

다음으로, 다음 명령을 사용하여 추출된 디렉토리의 이름을 tikiwiki로 바꾸십시오:

mv tiki-20.0 tikiwiki

다음으로, 다음 명령을 사용하여 tikiwiki 디렉토리에 적절한 권한을 부여하십시오:

chown -R www-data:www-data /var/www/html/tikiwiki/
chmod -R 755 /var/www/html/tikiwiki/

완료되면 다음 단계로 진행할 수 있습니다.

티키위키용 아파치 구성

다음으로, 티키위키를 위한 아파치 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

nano /etc/apache2/sites-available/tikiwiki.conf

다음 콘텐츠를 추가합니다.

<VirtualHost *:80>
     ServerAdmin 
     DocumentRoot /var/www/html/tikiwiki
     ServerName example.com

     <Directory /var/www/html/tikiwiki/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/tikiwiki_error.log
     CustomLog ${APACHE_LOG_DIR}/tikiwiki_access.log combined

</VirtualHost>

파일을 저장하고 닫습니다. 그런 다음 다음 명령을 사용하여 가상 호스트 구성 파일을 활성화합니다.

a2ensite tikiwiki.conf

마지막으로 Apache 재작성 모듈을 활성화하고 Apache 서비스를 다시 시작하여 다음 명령을 사용하여 구성 변경 사항을 다시 로드합니다.

a2enmod rewrite
systemctl restart apache2

티키위키 웹 인터페이스에 접근

이제 웹 브라우저를 열고 URL http://example.com을 입력하십시오. TikiWiki 환영 페이지로 리디렉션됩니다:

언어를 선택하고 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

라이선스 계약에 동의하고 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

시스템이 최소 요구 사항을 충족하는지 확인하고 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

데이터베이스 이름, 데이터베이스 사용자 이름 및 비밀번호를 제공하십시오. 그런 다음 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

데이터베이스 엔진을 선택하고 설치 버튼을 클릭하여 설치를 시작합니다. 설치가 성공적으로 완료되면 다음 페이지가 표시됩니다.

이제 계속 버튼을 클릭하면 다음 페이지가 표시됩니다.

Wiki 제목, 발신자 이메일, 보안 로그인, 관리자 이메일과 같은 모든 필수 정보를 제공하고 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

모든 정보를 읽고 계속 버튼을 클릭하십시오. 다음 페이지가 표시됩니다.

이제 "티키 입력 및 설치 프로그램 잠금" 버튼을 클릭하십시오. 다음 페이지가 표시됩니다.

이제 관리자 비밀번호를 설정하고 적용 버튼을 클릭하십시오. 다음 페이지가 표시됩니다.

Let's Encrypt로 TikiWiki 보안

이 섹션에서는 무료 SSL을 암호화하자로 티키위키 사이트를 보호하는 방법을 설명합니다.

먼저 Certbot 도구를 설치하여 웹사이트용 Let's Encrypt 무료 SSL을 다운로드하고 설치해야 합니다. 기본적으로 최신 버전의 Certbot은 Debian 10 기본 리포지토리에서 사용할 수 없습니다. 따라서 시스템에 Certbot 리포지토리를 추가해야 합니다.

다음 명령을 사용하여 Certbot 리포지토리를 추가할 수 있습니다.

apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot

다음으로 다음 명령을 사용하여 리포지토리를 업데이트하고 Certbot을 설치합니다.

apt-get update -y
apt-get install certbot python-certbot-apache -y

설치가 완료되면 Let’s Encrypt에 대한 well-known.conf 파일을 생성하여 도메인을 확인합니다.

먼저 .well-known 디렉토리를 만들고 적절한 권한을 부여합니다.

mkdir -p /var/lib/letsencrypt/.well-known
chgrp www-data /var/lib/letsencrypt
chmod g+s /var/lib/letsencrypt

다음으로 다음 명령을 사용하여 well-known.conf 파일을 만듭니다.

nano /etc/apache2/conf-available/well-known.conf

다음 줄을 추가합니다.

Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/"
<Directory "/var/lib/letsencrypt/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

파일을 저장하고 닫습니다. 그런 다음 다음 명령을 사용하여 필요한 모듈을 활성화합니다.

a2enmod ssl
a2enmod http2
a2enmod headers
a2enconf well-known

다음으로 Apache 서비스를 다시 시작하여 모든 구성 변경 사항을 적용합니다.

systemctl restart apache2

이제 다음 명령을 사용하여 도메인 example.com에 대한 무료 SSL 인증서 설치를 시작하겠습니다.

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/example.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/example.com-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/example.com-le-ssl.conf

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를 선택하여 도메인용 무료 SSL 인증서를 다운로드하고 설치합니다. 일단 설치가 성공적으로 완료되었습니다. 다음 출력이 표시되어야 합니다.

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/example.com.conf to ssl vhost in /etc/apache2/sites-available/
example.com-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://example.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example.com/privkey.pem
   Your cert will expire on 2019-10-22. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

그게 다야. 이제 웹 브라우저를 열고 URL https://example.com을 사용하여 TikiWiki CMS에 액세스하십시오. 귀하의 TikiWiki 사이트는 무료 SSL 인증서로 적절하게 보호되어야 합니다.