Ubuntu 20.04에서 Nginx와 함께 Bolt CMS를 설치하는 방법
이 페이지에서
- 전제 조건
- 시작하기\n
- LEMP 서버 설치
- Bolt용 데이터베이스 생성
- 볼트 CMS 다운로드
- Bolt용 Nginx 구성
- 볼트 CMS에 액세스
- Lets Encrypt SSL로 BoltCMS 보안
- 결론
Bolt는 PHP 기반의 가볍고 간단한 무료 오픈 소스 콘텐츠 관리 시스템입니다. 사용하기 쉽도록 설계되었으며 강력하고 동적인 콘텐츠 웹사이트를 쉽게 만들 수 있도록 도와줍니다. Silex 마이크로프레임워크를 기반으로 하며 최신 PHP 시스템을 찾는 사람들에게 훌륭한 대안입니다. 최신 오픈 소스 라이브러리를 사용하여 생성되며 최신 마크업을 사용하여 HTML5로 사이트를 구축하는 데 가장 적합합니다.
이 튜토리얼에서는 Ubuntu 20.04에서 Nginx와 Lets Encrypt SSL을 사용하여 Bolt CMS를 설치하는 방법을 보여줍니다.
전제 조건
- Ubuntu 20.04를 실행하는 서버.\n
- 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
- 루트 암호는 서버에 구성됩니다.\n
시작하기
시작하기 전에 항상 최신 버전의 패키지로 시스템을 업데이트하는 것이 좋습니다. 다음 명령으로 업데이트할 수 있습니다.
apt-get update -y
모든 패키지가 업데이트되면 다음 명령을 실행하여 다른 종속성을 설치합니다.
apt-get install software-properties-common gnupg2 unzip git -y
모든 종속성을 설치한 후 다음 단계로 진행할 수 있습니다.
LEMP 서버 설치
먼저 다음 명령을 실행하여 Nginx 및 MariaDB 서버를 설치합니다.
apt-get install nginx mariadb-server -y
다음으로 서버에 PHP 버전 7.2를 설치해야 합니다. 기본적으로 Ubuntu 20.04는 PHP 버전 7.4와 함께 제공됩니다. 따라서 시스템에 Ondrej PHP 저장소를 추가해야 합니다.
다음 명령을 사용하여 PHP 리포지토리를 추가할 수 있습니다.
add-apt-repository ppa:ondrej/php
리포지토리가 추가되면 리포지토리를 업데이트하고 다음 명령을 사용하여 PHP 및 기타 필요한 확장을 설치합니다.
apt-get update -y
apt-get install php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-zip php7.2-pgsql php7.2-sqlite3 php7.2-curl php7.2-gd php7.2-mysql php7.2-intl php7.2-json php7.2-opcache php7.2-xml -y
Once all the packages are installed, you can proceed to the next step.
Bolt용 데이터베이스 생성
다음으로 Bolt를 위한 데이터베이스와 사용자를 생성해야 합니다. 먼저 다음 명령을 사용하여 MariaDB에 로그인합니다.
mysql
로그인 후 다음 명령을 사용하여 데이터베이스와 사용자를 생성합니다.
MariaDB [(none)]> CREATE DATABASE boltdb;
MariaDB [(none)]> CREATE USER 'bolt'@'localhost' IDENTIFIED BY 'password';
다음으로 다음 명령을 사용하여 Bolt 데이터베이스에 대한 모든 권한을 부여합니다.
MariaDB [(none)]> GRANT ALL ON boltdb.* TO 'bolt'@'localhost';
그런 다음 권한을 플러시하고 다음 명령을 사용하여 MariaDB 셸을 종료합니다.
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
완료되면 다음 단계로 진행할 수 있습니다.
볼트 CMS 다운로드
먼저 Git 저장소에서 최신 버전의 Bolt CMS를 다운로드해야 합니다. 다음 명령을 실행하여 Nginx 루트 디렉토리에 다운로드할 수 있습니다.
cd /var/www/html
git clone https://github.com/bolt/bolt.git
Bolt가 다운로드되면 디렉터리를 bolt로 변경하고 샘플 구성 파일을 복사합니다.
cd bolt
cp app/config/config.yml.dist app/config/config.yml
다음으로 config.yml 파일을 편집하고 데이터베이스 설정을 정의합니다.
nano app/config/config.yml
기본 sqlite 데이터베이스 행을 제거하고 다음 행을 추가하십시오.
database: driver: mysql username: bolt password: password databasename: boltdb host: localhost prefix: prefix_
완료되면 파일을 저장하고 닫습니다.
다음으로 시스템에 Composer를 설치해야 합니다. Composer는 PHP의 종속성 관리자입니다. 다음 명령으로 설치할 수 있습니다.
wget -O composer-setup.php https://getcomposer.org/installer
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Composer가 설치되면 다음과 같은 결과가 표시됩니다.
All settings correct for using Composer Downloading... Composer (version 2.0.2) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer
다음으로 다음 명령을 사용하여 Bolt CMS에 필요한 PHP 종속성을 설치합니다.
composer install
모든 종속 항목이 설치되면 굵게 표시된 디렉터리의 소유권과 권한을 변경합니다.
chown -R www-data:www-data /var/www/html/bolt
chmod -R 755 /var/www/html/bolt
완료되면 다음 단계로 진행할 수 있습니다.
Bolt용 Nginx 구성
다음으로 Bolt CMS용 Nginx 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.
nano /etc/nginx/sites-available/bolt.conf
다음 줄을 추가합니다.
server { listen 80; root /var/www/html/bolt; index index.php index.html index.htm; server_name bolt.example.com; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ [^/]\.php(/|$) { try_files /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location = /bolt { try_files $uri /index.php?$query_string; } location ^~ /bolt/ { try_files $uri /index.php?$query_string; } }
완료되면 파일을 저장하고 닫은 후 다음 명령을 사용하여 Nginx 가상 호스트 파일을 활성화합니다.
ln -s /etc/nginx/sites-available/bolt.conf /etc/nginx/sites-enabled/bolt.conf
다음으로 다음 명령을 사용하여 구성 오류에 대해 Nginx를 확인합니다.
nginx -t
다음 출력이 표시되어야 합니다.
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
마지막으로 Nginx 서비스를 다시 시작하여 변경 사항을 적용합니다.
systemctl restart nginx
이 시점에서 Nginx는 Bolt CMS를 제공하도록 구성됩니다. 이제 다음 단계를 진행할 수 있습니다.
Bolt CMS에 액세스
이제 웹 브라우저를 열고 URL http://bolt.example.com을 입력합니다. 다음 페이지로 리디렉션됩니다.
원하는 사용자 이름, 비밀번호, 이메일을 제공하고 첫 번째 사용자 만들기 버튼을 클릭합니다. 다음 페이지에서 Bolt CMS 대시보드를 볼 수 있습니다.
이제 사이트 보기 버튼을 클릭합니다. 다음 페이지에서 Bolt CMS 단순 사이트 페이지를 볼 수 있습니다.
Lets Encrypt SSL로 BoltCMS 보호
Lets Encrypt SSL로 웹 사이트를 보호하는 것은 항상 좋은 생각입니다. 먼저 다음 명령을 사용하여 서버에 Certbot Lets Encrypt 클라이언트를 설치합니다.
apt-get install python3-certbot-nginx -y
설치가 완료되면 다음 명령을 실행하여 Lets Encrypt SSL로 웹 사이트를 보호하십시오.
certbot --nginx -d bolt.example.com
유효한 이메일 주소를 제공하고 아래와 같이 서비스 약관에 동의하라는 메시지가 표시됩니다.
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx 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 bolt.example.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/bolt.conf
다음으로, 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택합니다.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 all traffic on port 80 to ssl in /etc/nginx/sites-enabled/bolt.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://bolt.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=bolt.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/bolt.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/bolt.example.com/privkey.pem Your cert will expire on 2020-10-30. 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.
이제 귀하의 BoltCMS 웹사이트는 Lets Encrypt SSL로 보호됩니다. URL https://bolt.example.com을 사용하여 안전하게 액세스할 수 있습니다.
결론
축하합니다! Nginx와 함께 Bolt CMS를 성공적으로 설치했으며 Ubuntu 20.04 서버에 Lets Encrypt SSL을 사용했습니다. 이제 Bolt 대시보드를 사용하여 나만의 웹사이트를 쉽게 만들 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.