웹사이트 검색

Ubuntu 22.04에서 Apache 및 무료 Lets Encrypt SSL을 사용하여 phpBB 포럼을 설치하는 방법


이 페이지에서

  1. 전제 조건
  2. Apache, MariaDB 및 PHP 설치
  3. phpBB용 데이터베이스 생성
  4. phpBB 다운로드
  5. phpBB용 Apache 구성
  6. phpBB 웹 인터페이스에 액세스
  7. Lets Encrypt SSL로 phpBB 보호\n
  8. 결론

phpBB는 사람들이 모여 서로 소통할 수 있는 공간을 제공하는 무료 오픈 소스 포럼 소프트웨어입니다. PHP로 작성되었으며 MariaDB를 데이터베이스 백엔드로 사용합니다. 하위 포럼, 사용자 그룹, 전체 텍스트 검색, 플러그인 및 이메일 알림을 포함한 다양한 기능을 제공합니다. 완전히 확장 가능하고 사용자 정의가 가능하며 사용자 친화적인 인터페이스와 간단한 관리 옵션이 있습니다.

이 게시물은 Ubuntu 22.04에서 Apache와 Lets Encrypt SSL을 사용하여 phpBB를 설치하는 방법을 보여줍니다.

전제 조건

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

Apache, MariaDB 및 PHP 설치

먼저 Apache 웹 서버, MariaDB 데이터베이스 서버, PHP 및 기타 패키지를 서버에 설치해야 합니다. 다음 명령을 실행하여 모두 설치할 수 있습니다.

apt install apache2 mariadb-server php libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml wget unzip -y

모든 패키지가 설치되면 다음 명령을 사용하여 Apache 서비스를 시작하고 활성화합니다.

systemctl start apache2
systemctl enable apache2

phpBB용 데이터베이스 생성

phpBB는 MariaDB를 사용하여 데이터를 저장합니다. 따라서 phpBB용 데이터베이스와 사용자를 생성해야 합니다. 먼저 다음 명령을 사용하여 MariaDB 셸에 로그인합니다.

mysql

로그인한 후 다음 명령을 사용하여 데이터베이스와 사용자를 생성합니다.

MariaDB [(none)]> CREATE DATABASE phpdb;
MariaDB [(none)]> GRANT ALL ON phpdb.* to 'phpuser'@'localhost' IDENTIFIED BY 'password';

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

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

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

phpBB 다운로드

다음으로 공식 다운로드 페이지에서 최신 버전의 phpBB를 다운로드해야 합니다. 다음 명령으로 다운로드할 수 있습니다.

wget https://download.phpbb.com/pub/release/3.3/3.3.7/phpBB-3.3.7.zip

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

unzip phpBB-3.3.7.zip

다음으로 추출된 디렉터리를 Apache 웹 루트 디렉터리로 이동합니다.

mv phpBB3 /var/www/html/phpbb

다음으로 phpbb 디렉토리의 소유권과 권한을 변경합니다.

chown -R www-data:www-data /var/www/html/phpbb
chmod -R 775 /var/www/html/phpbb

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

phpBB용 Apache 구성

다음으로 phpBB를 호스팅할 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

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

다음 줄을 추가합니다.

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

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

ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log
CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined


</VirtualHost>

완료되면 파일을 저장하고 닫은 다음 Apache 가상 호스트를 활성화하고 다음 명령을 사용하여 모듈을 다시 작성합니다.

a2ensite phpbb
a2enmod rewrite

다음으로 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 Sat 2022-05-28 10:50:04 UTC; 2s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22212 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22217 (apache2)
      Tasks: 6 (limit: 2292)
     Memory: 15.8M
        CPU: 98ms
     CGroup: /system.slice/apache2.service
             ??22217 /usr/sbin/apache2 -k start
             ??22218 /usr/sbin/apache2 -k start
             ??22219 /usr/sbin/apache2 -k start
             ??22220 /usr/sbin/apache2 -k start
             ??22221 /usr/sbin/apache2 -k start
             ??22222 /usr/sbin/apache2 -k start

May 28 10:50:04 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

phpBB 웹 인터페이스에 액세스

이제 웹 브라우저를 열고 URL http://phpbb.example.com을 사용하여 phpBB 웹 인터페이스에 액세스하십시오. 다음 페이지가 표시됩니다.

INSTALL 탭을 클릭하고 Install 버튼을 클릭하여 설치를 시작합니다. 다음 페이지가 표시됩니다.

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

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

프로토콜, 웹사이트 도메인 이름, 포트, 경로를 제공하고 제출 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

SMTP 세부 정보를 제공하고 제출 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

언어, 보드 이름, 보드 설명을 선택하고 제출 버튼을 클릭하십시오. 다음 페이지가 표시됩니다.

ACP로 이동 버튼을 클릭합니다. 다음 페이지에 phpBB 제어판이 표시되어야 합니다.

Lets Encrypt SSL로 phpBB 보호

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

apt-get install python3-certbot-apache -y

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

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/phpbb.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/phpbb.example.com/privkey.pem
   Your cert will expire on 2022-08-12. 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://phpbb.example.com을 사용하여 안전하게 웹사이트에 액세스할 수 있습니다.

결론

축하합니다! Apache와 함께 phpBB를 성공적으로 설치했으며 Ubuntu 22.04에서 SSL을 암호화할 수 있습니다. 이제 phpBB 제어판을 탐색하고 첫 번째 보드 생성을 시작할 수 있습니다.