웹사이트 검색

Apache와 함께 Automad CMS를 설치하고 Debian 10에서 암호화하는 방법


이 페이지에서

  1. 요구 사항\n
  2. 시작하기\n
  3. Apache 및 PHP 설치
  4. Automad 설치
  5. Automad용 Apache 구성
  6. Automad 액세스
  7. Lets Encrypt로 Automad 보호\n

Automad는 PHP 언어로 작성된 무료 오픈 소스 플랫 콘텐츠 관리 시스템입니다. 빠르고 반응이 빠르며 다른 PHP 기반 CMS에서는 사용할 수 없는 기능을 제공합니다. Automad는 데이터베이스 대신 텍스트 파일을 사용하여 콘텐츠를 저장합니다. Automad는 사이트 관리, 시스템 설정, 이미지 업로드 및 블로그 게시물 작성을 위한 웹 기반 인터페이스를 제공합니다. Automad를 최신 상태로 유지하기 위해 내장된 Markdown 편집기 및 원클릭 업데이터와 함께 제공됩니다.

이 튜토리얼에서는 Apache 웹 서버를 사용하여 Debian 10에 Automad CMS를 설치하는 방법을 보여줍니다.

요구 사항

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

시작하기

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

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

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

아파치와 PHP 설치

Automad는 PHP를 기반으로 하며 웹 서버에서 실행됩니다. 따라서 Apache, PHP 및 기타 필수 모듈을 서버에 설치해야 합니다. 다음 명령을 실행하여 모두 설치할 수 있습니다.

apt-get install apache2 php libapache2-mod-php php-zip php-curl php-mbstring php-gd php-xml php-xmlrpc php-soap unzip -y

모든 패키지가 설치되면 Apache 웹 서버를 시작하고 다음 명령을 사용하여 시스템 재부팅 시 시작되도록 활성화합니다.

systemctl start apache2
systemctl enable apache2

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

오토매드 설치

먼저 Bitbucket 리포지토리에서 최신 버전의 Automad를 다운로드해야 합니다. 다음 명령으로 다운로드할 수 있습니다.

wget https://bitbucket.org/marcantondahmen/automad/get/default.zip

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

unzip default.zip

다음으로 다음 명령을 사용하여 추출된 디렉터리를 Apache 웹 루트로 이동합니다.

mv marcantondahmen-automad-c241e88edc3c /var/www/html/automad

다음으로 automad 디렉토리의 소유권을 www-data로 변경하고 다음 명령을 사용하여 적절한 권한을 부여하십시오.

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

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

Automad용 Apache 구성

다음으로 Automad 서버에 대한 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

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

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

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

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

     ErrorLog ${APACHE_LOG_DIR}/automadcms_error.log
     CustomLog ${APACHE_LOG_DIR}/automadcms_access.log combined

</VirtualHost>

완료되면 파일을 저장하고 닫습니다. 그런 다음 다음 명령을 사용하여 Apache에서 구문 오류를 확인합니다.

apachectl configtest

모든 것이 정상이면 다음과 같은 결과가 표시됩니다.

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

다음으로 Apache 가상 호스트를 활성화하고 다음 명령을 사용하여 모듈을 다시 작성합니다.

a2ensite automad
a2enmod rewrite

마지막으로 Apache 웹 서버를 다시 시작하여 구성 변경 사항을 적용합니다.

systemctl restart apache2

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

오토매드에 액세스

이제 Automad가 설치 및 구성되었으며 Automad 웹 인터페이스에 액세스할 시간입니다.

웹 브라우저를 열고 URL http://example.com을 입력합니다. 다음 화면에서 Automad 사이트로 리디렉션됩니다.

Automad 계정을 만들려면 웹 브라우저를 열고 URL http://example.com/dashboard를 방문하십시오. 다음 페이지로 리디렉션됩니다.

이제 원하는 사용자 이름과 비밀번호를 입력한 다음 계정 파일 다운로드 버튼을 클릭하여 사용자 등록 양식을 다운로드하고 구성 디렉토리에 복사합니다.

mv config.php /var/www/html/automad/config/

그런 다음 다음 명령을 사용하여 config.php 파일에 적절한 권한을 부여하십시오.

chown -R www-data:www-data /var/www/html/automad/config/config.php

이제 웹 브라우저를 열고 URL http://example.com/dashboard를 입력하십시오. Automad 로그인 페이지가 표시됩니다.

이제 사용자 이름과 암호를 입력하고 로그인 버튼을 클릭하십시오. 다음 페이지에 Automad CMS 기본 대시보드가 표시되어야 합니다.

Lets Encrypt로 보안 Automad

먼저, 웹사이트용 Lets Encrypt 무료 SSL을 다운로드하고 설치하려면 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

일단 설치되면 letsencrypt 디렉토리 안에 .well-known 디렉토리를 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

mkdir -p /var/lib/letsencrypt/.well-known

다음으로 letsencrypt 디렉터리에 적절한 권한을 부여해야 합니다. 다음 명령으로 수행할 수 있습니다.

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에 대한 Lets Encrypt 무료 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

귀하의 Automad CMS는 이제 Lets Encrypt 무료 SSL로 보호됩니다. URL https://example.com을 방문하여 액세스할 수 있습니다.