웹사이트 검색

데비안 9에 10월 CMS 플랫폼을 설치하는 방법


이 페이지에서

  1. 요구 사항\n
  2. 전제 조건
  3. 초기 단계
  4. 1단계 - PHP 및 필요한 PHP 확장 설치\n
  5. 2단계 - MariaDB 설치 및 10월 데이터베이스 생성
  6. 3단계 - Acme.sh 클라이언트 설치 및 Lets Encrypt 인증서 획득(선택 사항)\n
  7. 4단계 - NGINX 설치 및 10월용 NGINX 구성
  8. 5단계 - 10월 CMS 플랫폼 다운로드 및 설치\n
  9. 6단계 - 10월 설정 완료
  10. 링크

October CMS는 Laravel PHP 프레임워크를 기반으로 하는 무료 오픈 소스 자체 호스팅 CMS 플랫폼입니다. 10월 CMS 소스 코드는 Github에서 호스팅됩니다. 이 가이드에서는 NGINX를 웹 서버로, MariaDB를 데이터베이스 서버로 사용하여 Debian 9(스트레치) 운영 체제에서 10월 CMS 설치 프로세스를 안내하고 선택적으로 acme.sh 클라이언트를 사용하여 전송 계층을 보호할 수 있습니다. SSL 지원을 추가하기 위해 인증 기관 암호화를 허용합니다.

요구 사항

계속하기 전에 서버가 최소 시스템 요구 사항을 충족하는지 확인해야 합니다. 10월 CMS에는 웹 호스팅을 위한 다음과 같은 서버 요구사항이 있습니다.

  • PHP 버전 7.0 이상
  • PHP PDO 확장\n
  • cURL PHP 확장\n
  • OpenSSL PHP 확장\n
  • Mbstring PHP 라이브러리
  • Zip PHP 라이브러리
  • GD PHP 라이브러리
  • XML PHP 확장\n
  • JSON PHP 확장\n
  • mod_rewrite 또는 NGINX를 사용하는 Apache\n
  • 데이터베이스 서버(MariaDB, MySQL, PostgreSQL)

전제 조건

  • Debian 9(stretch)를 실행하는 시스템.\n
  • sudo 권한이 있는 루트가 아닌 사용자.\n

초기 단계

Debian 시스템 버전 확인:

lsb_release -ds
# Debian GNU/Linux 9.7 (stretch)

시간대 설정:

dpkg-reconfigure tzdata

운영 체제 패키지(소프트웨어)를 업데이트합니다. 이는 운영 체제 기본 소프트웨어 패키지에 대한 최신 업데이트 및 보안 수정 사항이 있는지 확인하기 때문에 중요한 첫 번째 단계입니다.

apt update && apt upgrade -y

Debian 운영 체제의 기본 관리에 필요한 몇 가지 필수 패키지를 설치합니다.

apt install -y curl wget vim git sudo unzip socat bash-completion dirmngr apt-transport-https

1단계 - PHP 및 필요한 PHP 확장 설치

10월 CMS 플랫폼에는 PHP 버전 7.0 이상이 필요합니다. 기본적으로 Debian 9의 기본 소프트웨어 리포지토리에는 PHP 버전 7.0이 있으며 이는 10월 CMS에 적합합니다.

PHP와 필요한 PHP 확장을 설치합니다.

sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-zip php7.0-gd php7.0-xml php7.0-mbstring 

모듈로 컴파일된 PHP를 표시하려면 다음을 실행할 수 있습니다.

php -m

ctype
curl
exif
fileinfo
. . .
. . .

PHP 버전 확인:

php --version

# PHP 7.0.33-0+deb9u1 (cli) (built: Dec  7 2018 11:36:49) ( NTS )
# Copyright (c) 1997-2017 The PHP Group
# Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
# with Zend OPcache v7.0.33-0+deb9u1, Copyright (c) 1999-2017, by Zend Technologies

PHP-FPM 서비스는 Debian 9 시스템에서 재부팅 시 자동으로 시작되고 활성화되므로 수동으로 시작하고 활성화할 필요가 없습니다. 다음 단계인 데이터베이스 설치 및 설정으로 넘어갈 수 있습니다.

2단계 - MariaDB 설치 및 10월 데이터베이스 생성

10월은 MySQL/MariaDB, PostgreSQL, SQLite, SQL 데이터베이스를 지원합니다. Debian 팀은 MySQL을 Debian 9(stretch)의 기본 데이터베이스인 MariaDB로 교체했으므로 이 가이드에서는 MariaDB를 데이터베이스 서버로 사용합니다. 원본 MySQL을 설치하려면 Oracle에서 관리하는 공식 MySQL 저장소를 추가하여 사용할 수 있습니다.

공식 MariaDB 저장소에서 MariaDB 데이터베이스 서버를 설치합니다.

sudo apt install -y software-properties-common dirmngr apt-transport-https
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] https://mirrors.nxthost.com/mariadb/repo/10.2/debian stretch main'
sudo apt update
sudo apt install -y mariadb-server

MariaDB 버전을 확인합니다.

mysql --version
# mysql  Ver 15.1 Distrib 10.2.21-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

mysql_secure 설치 스크립트를 실행하여 MariaDB 보안을 개선하고 MariaDB 루트 사용자의 비밀번호를 설정합니다.

sudo mysql_secure_installation

각 질문에 답하십시오.

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

sudo mysql -u root -p
# Enter password

10월 설치에 사용할 MariaDB 데이터베이스 및 사용자를 생성하고 자격 증명을 기억하십시오.

CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

MariaDB 셸에서 종료합니다.

quit

3단계 - Acme.sh 클라이언트 설치 및 Lets Encrypt 인증서 획득(선택 사항)

HTTPS로 웹 사이트를 보호할 필요는 없지만 사이트 트래픽을 보호하는 것이 좋습니다. Lets Encrypt에서 SSL 인증서를 얻기 위해 Acme.sh 클라이언트를 사용합니다. Acme.sh는 종속성이 없는 Lets Encrypt에서 SSL 인증서를 얻기 위한 순수 UNIX 셸 소프트웨어입니다.

Acme.sh 다운로드 및 설치:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh 
./acme.sh --install --accountemail example.com
source ~/.bashrc
cd ~

acme.sh 버전 확인:

acme.sh --version
# v2.8.0

도메인/호스트 이름에 대한 RSA 및 ECC/ECDSA 인증서를 얻습니다.

# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256

테스트를 위해 가짜 인증서를 원하는 경우 위 명령에 --staging 플래그를 추가할 수 있습니다.

위 명령어를 실행하면 인증서가 다음 위치에 있게 됩니다.

  • RSA의 경우: ~/example.com 디렉토리.
  • ECC/ECDSA의 경우: ~/example.com_ecc 디렉토리.

발급된 인증서를 나열하려면 다음을 실행할 수 있습니다.

acme.sh --list

인증서를 저장할 디렉터리를 만듭니다. /etc/letsencrypt 디렉토리를 사용합니다.

mkdir -p /etc/letsencrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc

인증서를 /etc/letsencrypt 디렉터리에 설치/복사합니다.

# RSA
acme.sh --install-cert -d example.com \
--cert-file /etc/letsencrypt/example.com/cert.pem \
--key-file /etc/letsencrypt/example.com/private.key \
--fullchain-file /etc/letsencrypt/example.com/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"

# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc \
--cert-file /etc/letsencrypt/example.com_ecc/cert.pem \
--key-file /etc/letsencrypt/example.com_ecc/private.key \
--fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem \
--reloadcmd "sudo systemctl reload nginx.service"

모든 인증서는 60일마다 자동으로 갱신됩니다.

인증서를 얻은 후 루트 사용자를 종료하고 일반 sudo 사용자로 돌아갑니다.

exit

4단계 - NGINX 설치 및 10월용 NGINX 구성

NGINX 웹 서버 설치:

sudo apt install -y nginx

NGINX 버전 확인:

sudo nginx -v
# nginx version: nginx/1.10.3

다음을 실행하여 10월에 NGINX를 구성합니다.

sudo vim /etc/nginx/sites-available/october.conf

그리고 다음 구성으로 파일을 채웁니다.

server {
listen [::]:443 ssl http2;
listen 443 ssl http2; listen [::]:80; listen 80; server_name example.com; index index.php index.html; root /var/www/october;
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
location / { try_files $uri $uri/ /index.php?$query_string; }

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_read_timeout 120s;
}

location ~ ^/favicon\.ico { try_files $uri /index.php; }
location ~ ^/sitemap\.xml { try_files $uri /index.php; }
location ~ ^/robots\.txt { try_files $uri /index.php; }
location ~ ^/humans\.txt { try_files $uri /index.php; }
location ~ ^/storage/app/uploads/public { try_files $uri 404; }
location ~ ^/storage/app/media { try_files $uri 404; }
location ~ ^/storage/temp/public { try_files $uri 404; }
location ~ ^/modules/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/behaviors/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/behaviors/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/widgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/widgets/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/formwidgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/formwidgets/.*/resources { try_files $uri 404; }
location ~ ^/modules/.*/reportwidgets/.*/assets { try_files $uri 404; }
location ~ ^/modules/.*/reportwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/behaviors/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/behaviors/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/resources { try_files $uri 404; }
location ~ ^/plugins/.*/.*/widgets/.*/assets { try_files $uri 404; }
location ~ ^/plugins/.*/.*/widgets/.*/resources { try_files $uri 404; }
location ~ ^/themes/.*/assets { try_files $uri 404; }
location ~ ^/themes/.*/resources { try_files $uri 404; } }

파일을 sites-enabled 디렉토리에 연결하여 새로운 october.conf 구성을 활성화합니다.

sudo ln -s /etc/nginx/sites-available/october.conf /etc/nginx/sites-enabled

구문 오류에 대한 NGINX 구성 확인:

sudo nginx -t

NGINX 서비스 다시 로드:

sudo systemctl reload nginx.service

5단계 - 10월 CMS 플랫폼 다운로드 및 설치

문서 루트 디렉터리를 만듭니다.

sudo mkdir -p /var/www/october

/var/www/october 디렉토리의 소유권을 [your_user]:로 변경합니다.

sudo chown -R [your_user]:[your_user] /var/www/october

문서 루트로 이동합니다.

cd /var/www/october

10월 CMS 설치 프로그램 다운로드:

wget https://octobercms.com/download -O october.zip

10월 CMS 설치 프로그램 압축 해제:

unzip october.zip
rm october.zip
mv install-master/* .

/var/www/october 디렉토리의 소유권을 www-data:로 변경합니다.

sudo chown -R www-data:www-data /var/www/october

웹 브라우저에서 example.com/install.php와 같은 install.php 스크립트로 이동하고 설치 지침을 따릅니다.

6단계 - 10월 설정 완료

시스템 확인이 정상인지 확인하고 "동의 및 계속" 버튼을 눌러 진행합니다.

데이터베이스 및 관리자 사용자 설정을 구성합니다.

일부 고급 설정을 구성하거나 기본값을 그대로 둘 수도 있습니다.

마지막으로 모든 것이 구성되면 파란색 \계속\ 버튼을 누릅니다.

다음으로 "사이트를 어떻게 설정하시겠습니까?"라는 질문을 받게 됩니다. 3가지 옵션이 있습니다: 처음부터 시작, 테마에서 시작, 프로젝트 ID 사용. 선호하는 옵션을 선택하십시오.

10월 CMS 플랫폼의 관리 영역에 액세스하려면 URL/IP에 /backend를 추가하기만 하면 됩니다.

설치 후 보안상의 이유로 설치 파일, install.php 스크립트 및 install_files 디렉토리를 삭제해야 합니다.

sudo rm /var/www/october/install.php && sudo rm -rf /var/www/october/install_files

연결

  • https://github.com/octobercms/october