웹사이트 검색

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


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

  • 데비안 10(버스터)
  • 데비안 9(스트레치)

이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. LAMP 서버 설치
  4. Joomla용 데이터베이스 만들기
  5. 줌라 설치
  6. Apache 웹 서버 구성
  7. 액세스 Joomla
  8. Lets Encrypt SSL로 Joomla 보안
  9. 결론

Joomla는 웹사이트의 콘텐츠를 생성, 수정 및 관리하는 데 사용되는 무료 오픈 소스 콘텐츠 관리 시스템입니다. 간단하고 사용하기 쉬우므로 웹 사이트를 구축하는 데 HTML 또는 CSS 지식이 필요하지 않습니다. PHP로 작성되었으며 MySQL을 데이터베이스로 사용합니다. 즉시 사용할 수 있는 유연한 콘텐츠 관리 시스템이 되도록 다양한 기능을 제공합니다. 기능을 사용자 정의하고 확장할 수 있는 수백 개의 무료 확장 기능이 함께 제공됩니다.

이 자습서에서는 Apache와 함께 Joomla CMS를 설치하고 Debian 10에서 Lets Encrypt하는 방법을 보여줍니다.

전제 조건

  • Debian 10을 실행하는 서버.\n
  • 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
  • 루트 암호는 서버에 구성됩니다.\n

시작하기

먼저 다음 명령을 실행하여 시스템 패키지를 업데이트된 버전으로 업데이트합니다.

apt-get update -y

모든 패키지가 업데이트되면 다음 단계로 진행할 수 있습니다.

램프 서버 설치

다음으로 Apache 웹 서버, MariaDB 데이터베이스, PHP 및 기타 PHP 확장을 시스템에 설치해야 합니다. 다음 명령으로 모두 설치할 수 있습니다.

apt-get install apache2 mariadb-server php openssl php-imagick php-common php-curl php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip -y

모든 패키지가 설치되면 다음 단계로 진행할 수 있습니다.

Joomla용 데이터베이스 생성

Joomla는 MySQL 또는 MariaDB를 사용하여 콘텐츠를 저장합니다. 따라서 Joomla용 데이터베이스와 사용자를 만들어야 합니다.

먼저 다음 명령을 사용하여 MariaDB에 연결합니다.

mysql

연결되면 다음 명령을 사용하여 데이터베이스와 사용자를 만듭니다.

MariaDB [(none)]> CREATE DATABASE joomladb;
MariaDB [(none)]> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'password';

다음으로 다음 명령을 사용하여 권한을 플러시하고 MariaDB를 종료합니다.

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

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

줌라 설치

그런 다음 다음 명령을 사용하여 최신 버전의 Joomla를 다운로드합니다.

wget https://downloads.joomla.org/cms/joomla3/3-9-25/Joomla_3-9-25-Stable-Full_Package.tar.bz2

다운로드가 완료되면 Apache 웹 루트 내에 Joomla용 디렉토리를 생성합니다.

mkdir /var/www/html/joomla

그런 다음 다음 명령을 실행하여 다운로드한 파일을 Joomla 디렉터리에 추출합니다.

bunzip2 Joomla_3-9-25-Stable-Full_Package.tar.bz2
tar -xvf Joomla_3-9-25-Stable-Full_Package.tar -C /var/www/html/joomla/

그런 다음 다음 명령을 사용하여 Joomla 디렉터리에 적절한 권한과 소유권을 설정합니다.

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

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

Apache 웹 서버 구성

다음으로 Joomla를 호스팅할 Apache 가상 호스트 구성 파일을 만들어야 합니다.

다음 명령으로 만들 수 있습니다.

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

다음 줄을 추가합니다.

<VirtualHost *:80>
   ServerName joomla.example.com 
   ServerAdmin 
   DocumentRoot /var/www/html/joomla
   <Directory /var/www/html/joomla>
	    Allowoverride all
   </Directory>
</VirtualHost>

파일을 저장하고 닫은 후 다음 명령을 사용하여 Apache 가상 호스트를 활성화합니다.

a2ensite joomla

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

systemctl restart 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 Mon 2021-03-22 09:26:20 UTC; 4s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 14495 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 14499 (apache2)
    Tasks: 6 (limit: 4701)
   Memory: 18.8M
   CGroup: /system.slice/apache2.service
           ??14499 /usr/sbin/apache2 -k start
           ??14500 /usr/sbin/apache2 -k start
           ??14501 /usr/sbin/apache2 -k start
           ??14502 /usr/sbin/apache2 -k start
           ??14503 /usr/sbin/apache2 -k start
           ??14504 /usr/sbin/apache2 -k start

Mar 22 09:26:20 debian10 systemd[1]: Starting The Apache HTTP Server...

줌라 액세스

이제 웹 브라우저를 열고 URL http://joomla.example.com을 사용하여 Joomla 웹 인터페이스에 액세스하십시오. 다음 페이지로 리디렉션됩니다.

이제 사이트 이름, 이메일 주소, 관리자 사용자 이름, 비밀번호를 제공하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

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

이제 모든 설정을 확인하고 설치 버튼을 클릭하여 설치를 시작합니다. 설치가 완료되면 다음 페이지가 표시됩니다.

설치 폴더 제거를 클릭합니다. 다음 페이지가 표시됩니다.

이제 관리자 버튼을 클릭하면 Joomla 로그인 페이지가 표시됩니다.

관리자 자격 증명을 제공하고 로그인 버튼을 클릭하면 다음 이미지에 Joomla 제어판이 표시됩니다.

Lets Encrypt SSL로 보안 Joomla

Lets Encrypt SSL로 웹 사이트를 보호하는 것은 항상 좋은 생각입니다. SSL을 설치하고 관리하려면 Certbot 클라이언트를 설치해야 합니다. 다음 명령으로 설치할 수 있습니다.

apt-get install python3-certbot-apache -y

Certbot이 설치되면 다음 명령을 실행하여 Lets Encrypt SSL로 웹 사이트를 보호하십시오.

certbot --apache -d joomla.example.com

아래와 같이 이메일을 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/joomla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/joomla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/joomla-le-ssl.conf

다음으로 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.

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 키를 눌러 웹사이트에 Lets Encrypt SSL을 설치합니다.

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.example.com/privkey.pem
   Your cert will expire on 2020-10-23. 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

결론

축하합니다! Debian 10 서버에 Joomla CMS를 성공적으로 설치했습니다. 이제 Joomla를 사용하여 자신만의 웹사이트를 쉽게 구축할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.