웹사이트 검색

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


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

  • Ubuntu 22.04(Jammy Jellyfish)
  • Ubuntu 14.04 LTS(Trusty Tahr)

이 페이지에서

  1. 전제 조건
  2. LAMP 서버 설치
  3. Joomla용 MySQL 데이터베이스 만들기
  4. 줌라 다운로드
  5. Joomla용 Apache 가상 호스트 만들기\n
  6. Joomla 웹 설치 액세스
  7. Lets Encrypt SSL로 Joomla 보안
  8. 결론

Joomla는 수상 경력에 빛나는 무료 오픈 소스 콘텐츠 관리 시스템으로 웹사이트와 온라인 웹 애플리케이션을 구축할 수 있습니다. PHP로 작성되었으며 MySQL을 데이터베이스 백엔드로 사용합니다. Joomla는 사용자가 콘텐츠를 효율적으로 구성하고 관리하는 데 도움이 되는 몇 가지 뛰어난 기능을 제공합니다. 확장 가능하고 사용하기 쉬우며 검색 엔진에 친숙하며 사용자 친화적인 웹 인터페이스를 제공하여 중앙 위치에서 웹 사이트를 관리할 수 있습니다.

이 게시물에서는 Apache와 함께 Joomla CMS를 설치하고 Ubuntu 22.04에서 SSL을 암호화하도록 하는 방법을 보여줍니다.

전제 조건

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

램프 서버 설치

먼저 다음 명령을 사용하여 Apache 웹 서버, MySQL 데이터베이스 서버 및 기타 확장이 포함된 최신 버전의 PHP를 설치합니다.

apt install apache2 mysql-server php8.1 libapache2-mod-php8.1 php8.1-dev php8.1-bcmath php8.1-intl php8.1-soap php8.1-zip php8.1-curl php8.1-mbstring php8.1-mysql php8.1-gd php8.1-xml unzip -y

모든 패키지가 설치되면 다음 명령을 사용하여 PHP 버전을 확인합니다.

php -v

다음 출력이 표시되어야 합니다.

PHP 8.1.2 (cli) (built: Apr  7 2022 17:46:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

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

Joomla용 MySQL 데이터베이스 생성

다음으로 웹 콘텐츠를 저장할 Joomla용 데이터베이스와 사용자를 만들어야 합니다. 먼저 다음 명령을 사용하여 MySQL에 연결합니다.

mysql

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

mysql> CREATE DATABASE joomladb;
mysql> CREATE USER 'joomlauser'@'localhost' IDENTIFIED BY 'securepassword';

다음으로 다음 명령을 사용하여 Joomla 데이터베이스에 대한 모든 권한을 부여합니다.

mysql> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost';

다음으로 다음 명령을 사용하여 권한 테이블을 플러시하고 MySQL을 종료합니다.

mysql> FLUSH PRIVILEGES;
mysql> EXIT;

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

줌라 다운로드

이 튜토리얼을 작성할 당시 Joomla의 최신 버전은 4.2.1입니다. 다음 명령을 사용하여 공식 웹 사이트에서 다운로드할 수 있습니다.

wget https://downloads.joomla.org/cms/joomla4/4-1-2/Joomla_4-1-2-Stable-Full_Package.zip

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

unzip Joomla_4-1-2-Stable-Full_Package.zip -d /var/www/html/joomla

그런 다음 다음 명령을 사용하여 Joomla의 소유권 및 권한을 변경하십시오.

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

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

Joomla용 Apache 가상 호스트 만들기

다음으로 Joomla용 Apache 가상 호스트 구성 파일을 만들어야 합니다. 다음 명령으로 만들 수 있습니다.

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

다음 줄을 추가합니다.

<VirtualHost *:80>

ServerAdmin 

ServerName joomla.example.com
DocumentRoot /var/www/html/joomla

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

ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined

</VirtualHost>

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

a2ensite joomla.conf

다음으로 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 Fri 2022-04-29 07:59:59 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 16393 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 16398 (apache2)
      Tasks: 6 (limit: 4630)
     Memory: 13.8M
        CPU: 129ms
     CGroup: /system.slice/apache2.service
             ??16398 /usr/sbin/apache2 -k start
             ??16399 /usr/sbin/apache2 -k start
             ??16400 /usr/sbin/apache2 -k start
             ??16401 /usr/sbin/apache2 -k start
             ??16402 /usr/sbin/apache2 -k start
             ??16403 /usr/sbin/apache2 -k start

Apr 29 07:59:59 ubuntu systemd[1]: Starting The Apache HTTP Server...

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

Joomla 웹 설치에 액세스

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

언어를 선택하고 사이트 이름을 정의한 다음 로그인 데이터 설정을 클릭하십시오. 다음 페이지가 표시됩니다.

실명, 사용자 이름, 비밀번호, 이메일 주소를 제공하고 데이터베이스 연결 설정을 클릭합니다. 다음 페이지가 표시됩니다.

데이터베이스 이름, 데이터베이스 사용자 이름, 호스트, 암호를 제공하고 Joomla 설치 버튼을 클릭합니다. 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 2023-01-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

이제 URL https://joomla.example.com을 사용하여 안전하게 웹사이트에 액세스할 수 있습니다.

결론

축하합니다! Apache와 함께 Joomla를 성공적으로 설치했으며 Ubuntu 22.04에서 SSL을 암호화할 수 있습니다. 이제 Joomla 플랫폼을 사용하여 웹사이트를 쉽게 만들고 호스팅할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.