웹사이트 검색

Apache2로 Joomla를 설치하고 Ubuntu 20.04에서 암호화하는 방법


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

  • Ubuntu 14.04 LTS(Trusty Tahr)

이 페이지에서

  1. 전제 조건
  2. LAMP 서버 설치
  3. 데이터베이스 만들기
  4. Joomla 다운로드 및 설치
  5. Joomla용 Apache 구성
  6. Lets Encrypt SSL로 Joomla 보안
  7. Joomla CMS에 액세스
  8. 결론

Joomla는 온라인 애플리케이션 및 웹사이트 게시에 사용되는 오픈 소스 콘텐츠 관리 시스템입니다. PHP로 작성되었으며 MySQL/MariaDB를 데이터베이스 백엔드로 사용합니다. 간단하고 사용자 친화적이며 모바일 지원 모델-뷰-컨트롤러 웹 애플리케이션 프레임워크를 기반으로 합니다. Joomla는 전문적인 사이트 구축에 적합한 수많은 기능과 디자인을 제공합니다.

이 자습서에서는 Apache와 함께 Joomla CMS를 설치하고 Ubuntu 20.04에서 Lets Encrypt SSL로 보안을 설정하는 방법을 보여줍니다.

전제 조건

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

램프 서버 설치

먼저 시스템에 Apache 웹 서버, MariaDB, PHP 및 기타 PHP 확장을 설치해야 합니다. 다음 명령을 사용하여 설치할 수 있습니다.

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-mysql php7.4-json php7.4-opcache php7.4-mbstring php7.4-intl php7.4-xml php7.4-gd php7.4-zip php7.4-curl php7.4-xmlrpc unzip -y

모든 패키지가 설치되면 php.ini 파일을 편집하고 일부 설정을 수정합니다.

nano /etc/php/7.4/apache2/php.ini

다음 값을 변경합니다.

memory_limit = 512M
upload_max_filesize = 256M
post_max_size = 256M
output_buffering = Off
max_execution_time = 300
date.timezone = Asia/Kolkata

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

데이터베이스 생성

먼저 MariaDB 설치를 보호하고 다음 명령을 사용하여 MariaDB 루트 암호를 설정합니다.

mysql_secure_installation

아래와 같이 모든 질문에 답하십시오.

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
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 셸에 로그인합니다.

mysql -u root -p

프롬프트가 표시되면 MariaDB 루트 암호를 제공한 후 다음 명령을 사용하여 Joomla용 데이터베이스 및 사용자를 생성합니다.

MariaDB [(none)]> CREATE DATABASE joomladb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
MariaDB [(none)]> GRANT ALL ON joomladb.* TO 'joomla'@'localhost' IDENTIFIED BY 'password';

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

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

줌라 다운로드 및 설치

먼저 공식 웹 사이트에서 다음 명령을 사용하여 최신 버전의 Joomla를 다운로드합니다.

wget https://downloads.joomla.org/cms/joomla3/3-9-18/Joomla_3-9-18-Stable-Full_Package.zip

다운로드가 완료되면 다음 명령을 사용하여 다운로드한 파일의 압축을 Apache 웹 루트 디렉터리에 풉니다.

unzip Joomla_3-9-18-Stable-Full_Package.zip -d /var/www/html/joomla

다음으로 다음 명령을 사용하여 joomla 디렉토리의 소유권을 www-data로 변경합니다.

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

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

Joomla용 Apache 구성

다음으로 Joomla를 제공할 새 Apache 가상 호스트 구성 파일을 만듭니다.

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

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

<VirtualHost *:80>
  ServerName joomla.linuxbuz.com
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/html/joomla

  ErrorLog ${APACHE_LOG_DIR}/joomla-error.log
  CustomLog ${APACHE_LOG_DIR}/joomla-access.log combined

  <Directory /var/www/html/joomla>
      Options FollowSymLinks
      AllowOverride All
      Require all granted
  </Directory>

</VirtualHost>

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

a2ensite joomla
systemctl restart apache2

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

Lets Encrypt SSL로 보안 Joomla

먼저 Lets Encrypt SSL을 설치하고 관리하려면 Certbot 클라이언트를 설치해야 합니다. 다음 명령으로 설치할 수 있습니다.

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

Certbot이 설치되면 다음 명령을 실행하여 웹 사이트용 Lets Encrypt SSL을 다운로드하고 설치합니다.

certbot --apache -d joomla.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 joomla.linuxbuz.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 키를 누르면 아래와 같이 설치가 완료됩니다.

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

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

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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

이 시점에서 Joomla 웹사이트는 Lets Encrypt SSL로 보호됩니다. 이제 다음 단계를 진행할 수 있습니다.

Joomla CMS에 액세스

이제 웹 브라우저를 열고 URL https://joomla.linuxbuz.com을 입력하십시오. Joomla 웹 기반 설치 마법사로 리디렉션됩니다.

사이트 이름, 관리자 이메일, 비밀번호를 제공하고 다음 버튼을 클릭합니다. 데이터베이스 구성 마법사가 표시되어야 합니다.

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

원하는 옵션을 선택하고 설치 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

모든 구성을 검토하고 설치 버튼을 클릭합니다. Joomla가 설치되면 다음 화면이 표시됩니다.

이제 설치 디렉토리를 제거하고 관리자 버튼을 클릭하십시오. Joomla 로그인 페이지가 표시됩니다.

Joomla 사용자 이름과 비밀번호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에서 Joomla 대시보드를 볼 수 있습니다.

URL https://joomla.linuxbuz.com을 방문하여 Joomla 웹사이트에 액세스할 수도 있습니다. 다음 페이지에서 Joomla 웹사이트를 볼 수 있습니다.

결론

축하합니다! Ubuntu 20.04에서 Lets Encrypt로 Joomla를 성공적으로 설치하고 보호했습니다. 이제 전자상거래 상점, 개인 웹사이트, 소셜 사이트 또는 블로그를 쉽게 구축할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.