웹사이트 검색

Apache와 함께 ElkArte 포럼을 설치하고 CentOS 8에서 SSL을 암호화하는 방법


이 페이지에서

  1. 전제 조건
  2. LAMP 서버 설치
  3. MariaDB 구성
  4. ElkArte 다운로드
  5. ElkArte용 Apache 구성
  6. Selinux 및 방화벽 구성\n
  7. ElkArte 액세스
  8. Lets Encrypt SSL로 안전한 Elkarte\n
  9. 결론

ElkArte는 Simple Machine Forum을 기반으로 하는 무료 오픈 소스 포럼 소프트웨어입니다. PHP로 작성되었으며 MariaDB를 데이터베이스 백엔드로 사용합니다. 완전한 기능을 갖춘 커뮤니티 포럼을 구축하는 데 필요한 모든 기능을 제공합니다. 단순하고 가벼우며 최신 브라우저, 스마트폰 또는 태블릿에 적합한 반응형 테마를 사용합니다.

특징

  • 간단하고 사용자 친화적인 인터페이스\n
  • 맞춤형 내장 애드온 관리자\n
  • 향상된 스팸 방지 기능\n
  • 첨부 파일 드래그 앤 드롭
  • youtube, vimeo 및 dailymotion을 위한 통합 비디오 임베딩\n

이 튜토리얼에서는 CentOS 8에서 Lets Encrypt SSL을 사용하여 ElkArte를 설치하는 방법을 보여줍니다.

전제 조건

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

램프 서버 설치

먼저 시스템에 Apache, MariaDB, PHP 및 기타 확장 프로그램을 설치해야 합니다. 다음 명령을 실행하여 모두 설치할 수 있습니다.

dnf install httpd mariadb-server php php-common php-json php-curl php-intl php-mbstring php-xmlrpc php-mysqlnd php-gd php-pgsql php-xml php-cli php-bcmath php-gmp php-zip unzip -y

모든 패키지가 설치되면 php.ini 파일을 편집하고 원하는 대로 변경합니다.

nano /etc/php.ini

다음 값을 변경합니다.

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

파일을 저장하고 닫은 후 Apache 및 MariaDB 서비스를 시작하고 다음 명령을 사용하여 시스템 재부팅 시 시작할 수 있도록 합니다.

systemctl start httpd
systemctl start mariadb
systemctl enable httpd
systemctl enable mariadb

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

MariaDB 구성

기본적으로 MariaDB 루트 암호는 설정되어 있지 않습니다. 따라서 시스템에서 설정해야 합니다. 다음 스크립트를 실행하여 이를 수행할 수 있습니다.

mysql_secure_installation

루트 암호를 설정하려면 아래와 같이 모든 질문에 답하십시오.

Enter current password for root (enter for none):
OK, successfully used password, moving on...
Set root password? [Y/n] Y
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가 보호되면 다음 명령을 사용하여 MariaDB 셸에 로그인합니다.

mysql -u root -p

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

MariaDB [(none)]> CREATE DATABASE elkarte;
MariaDB [(none)]> CREATE USER 'elkarte'@'localhost' IDENTIFIED BY 'password';

그런 다음 다음 명령을 사용하여 ElkArte 데이터베이스에 모든 권한을 부여합니다.

MariaDB [(none)]> GRANT ALL ON elkarte.* TO 'elkarte'@'localhost' WITH GRANT OPTION;

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

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

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

다운로드

먼저 Git 저장소에서 최신 버전의 ElkArte를 다운로드해야 합니다. 다음 명령으로 다운로드할 수 있습니다.

wget https://github.com/elkarte/Elkarte/archive/master.zip

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

unzip master.zip

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

mv Elkarte-master /var/www/html/elkarte

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

chown -R apache:apache /var/www/html/elkarte
chmod -R 775 /var/www/html/elkarte

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

ElkArte용 Apache 구성

다음으로 ElkArte용 아파치 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.

nano /etc/httpd/conf.d/elkarte.conf

다음 줄을 추가합니다.

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

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

     ErrorLog /var/log/httpd/error.log
     CustomLog /var/log/httpd//access.log combined

</VirtualHost>
systemctl restart httpd

이 시점에서 Apache 웹 서버는 ElkArte를 제공하도록 구성됩니다. 이제 다음 단계를 진행할 수 있습니다.

Selinux 및 방화벽 구성

기본적으로 SELinux는 CentOS 8에서 활성화되어 있습니다. 따라서 ElkArte 웹사이트에 맞게 구성해야 합니다.

다음 명령을 사용하여 SELinux를 구성할 수 있습니다.

setsebool httpd_can_network_connect on -P
chcon -R -u system_u -t httpd_sys_rw_content_t -r object_r /var/www/html/elkarte

그런 다음 다음 명령을 사용하여 방화벽을 통해 포트 80 및 443을 허용합니다.

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

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

액세스 ElkArte

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

계속 버튼을 클릭하여 설치를 시작합니다. 다음 페이지가 표시됩니다.

데이터베이스 세부 정보를 제공하고 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

포럼 이름, URL을 제공하고 계속 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

이제 계속 버튼을 클릭하여 데이터베이스를 채우십시오. 다음 페이지가 표시됩니다.

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

새로 설치된 포럼 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

관리자 사용자 이름, 암호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에서 ElkArte 대시보드를 볼 수 있습니다.

Lets Encrypt SSL로 안전한 Elkarte

이 시점에서 ElkArte가 설치되고 구성됩니다. 다음으로 Lets Encrypt SSL로 ElkArte 사이트를 보호하는 것이 좋습니다. 먼저 시스템에 Certbot 클라이언트를 설치해야 합니다. Certbot은 Lets Encrypt 웹사이트에서 SSL을 다운로드하고 다운로드한 SSL을 사용하도록 Apache 웹 서버를 구성하는 데 사용할 수 있는 Lets Encrypt 클라이언트입니다.

다음 명령을 사용하여 Certbot을 설치할 수 있습니다.

wget https://dl.eff.org/certbot-auto
mv certbot-auto /usr/local/bin/certbot-auto
chown root /usr/local/bin/certbot-auto
chmod 0755 /usr/local/bin/certbot-auto

이제 다음 명령을 실행하여 ElkArte 웹 사이트에 대한 SSL 인증서를 얻고 설치하십시오.

certbot-auto --apache -d elk.example.com

위의 명령은 먼저 서버에 필요한 모든 종속성을 설치합니다. 설치가 완료되면 아래와 같이 이메일 주소를 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.

참고 : SSL 관련 오류가 발생하면 httpd 서비스를 다시 시작하고 위 명령을 다시 실행하십시오.

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 elk.example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf.d/elkarte-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/elkarte-le-ssl.conf

그런 다음 HTTP 트래픽을 HTTPS로 리디렉션하여 HTTP 액세스를 제거할지 여부를 선택합니다.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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/httpd/conf.d/elkarte.conf to ssl vhost in /etc/httpd/conf.d/elkarte-le-ssl.conf

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/elk.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/elk.example.com/privkey.pem
   Your cert will expire on 2020-05-10. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot-auto 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

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

결론

축하합니다! Apache와 Lets Encrypt SSL on CentOS 8에 ElkArte를 성공적으로 설치했습니다. 이제 자신만의 온라인 포럼을 구축할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.