Debian 10에 X-Cart 전자상거래 플랫폼을 설치하는 방법
이 페이지에서
- 요구 사항\n
- 초기 단계
- 1단계 - PHP 및 PHP 확장 설치\n
- 2단계 - MariaDB 설치 및 데이터베이스 만들기
- 3단계 - acme.sh 클라이언트 설치 및 Lets Encrypt 인증서 받기(선택사항)\n
- 4단계 - Nginx 설치 및 구성
- 5단계 - X-Cart 설치
- 6단계 - 설정 완료
X-Cart는 수많은 기능과 통합 기능을 갖춘 매우 유연한 오픈 소스 전자상거래 플랫폼입니다. X-Cart 소스 코드는 Github에서 호스팅됩니다. 이 가이드에서는 Nginx를 웹 서버로 사용하고 MariaDB를 데이터베이스 서버로 사용하여 Debian 10에 X-Cart 5를 설치하는 과정을 설명합니다.
요구 사항
- PHP 버전 7.2 이상
- PHP 확장:
pdo
,phar
,mysql
,mbstring
,curl
\n - MySQL 버전 5.7.7 이상 또는 MariaDB 동급
- 엔진엑스
초기 단계
Debian 버전 확인:
lsb_release -ds
시간대 설정:
sudo dpkg-reconfigure tzdata
운영 체제 패키지(소프트웨어)를 업데이트합니다. 이는 운영 체제 기본 소프트웨어 패키지에 대한 최신 업데이트 및 보안 수정 사항이 있는지 확인하기 때문에 중요한 첫 번째 단계입니다.
sudo apt update && sudo apt upgrade -y
Debian 운영 체제의 기본 관리에 필요한 몇 가지 필수 패키지를 설치합니다.
sudo apt install -y curl wget vim git unzip socat bash-completion
1단계 - PHP 및 PHP 확장 설치
PHP와 필요한 PHP 확장을 설치합니다.
sudo apt install -y php php-cli php-fpm php-common php-mbstring php-curl php-mysql php-json php-xml php-phar php-pdo php-gd
모듈로 컴파일된 PHP를 표시하려면 다음을 실행할 수 있습니다.
php -m
ctype
curl
exif
fileinfo
. . .
. . .
PHP 버전 확인:
php --version
# PHP 7.3.17-0debian0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.2.17-0debian0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
PHP-FPM 서비스는 Debian 10 시스템에서 재부팅 시 자동으로 시작되고 활성화되므로 수동으로 시작하고 활성화할 필요가 없습니다. 다음 단계인 데이터베이스 설치 및 설정으로 넘어갈 수 있습니다.
2단계 - MariaDB 설치 및 데이터베이스 만들기
MySQL 설치:
sudo apt install -y mariadb-server
버전 확인:
mysql --version
# mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper
MariaDB 설치의 보안을 개선하려면 mysql_secure_installation
스크립트를 실행하세요.
sudo mysql_secure_installation
루트 사용자로 MariaDB에 로그인합니다.
sudo mysql -u root -p
# Enter password:
새 MariaDB 데이터베이스 및 사용자를 만들고 사용자 인증 정보를 기억하세요.
CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;
3단계 - acme.sh 클라이언트 설치 및 Lets Encrypt 인증서 받기(선택사항)
HTTPS로 웹 사이트를 보호할 필요는 없지만 사이트 트래픽을 보호하는 것이 좋습니다. Lets Encrypt에서 TLS 인증서를 얻기 위해 acme.sh 클라이언트를 사용합니다. Acme.sh는 종속성이 없는 Lets Encrypt에서 TLS 인증서를 얻기 위한 순수 UNIX 셸 소프트웨어입니다.
acme.sh를 다운로드하고 설치합니다.
sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail
source ~/.bashrc
cd ~
acme.sh 버전 확인:
acme.sh --version
# v2.8.6
도메인/호스트 이름에 대한 RSA 및 ECC/ECDSA 인증서 받기:<br>
# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256
테스트를 위해 가짜 인증서를 원하는 경우 위 명령에 --staging
플래그를 추가할 수 있습니다.
위 명령어를 실행하면 인증서 및 키가 다음 위치에 있게 됩니다.
- RSA의 경우:
/home/username/example.com
디렉토리. - ECC/ECDSA의 경우:
/home/username/example.com_ecc
디렉터리.
발급된 인증서를 나열하려면 다음을 실행할 수 있습니다.
acme.sh --list
인증서를 저장할 디렉터리를 만듭니다. /etc/letsencrypt
디렉토리를 사용합니다.
mkdir -p /etc/letsecnrypt/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 설치 및 구성
Nginx 설치:
sudo apt install -y nginx
Nginx 버전 확인:
sudo nginx -v
# nginx version: nginx/1.14.0
다음을 실행하여 X-Cart용 Nginx를 구성합니다.
sudo vim /etc/nginx/sites-available/xcart.conf
그리고 아래 구성으로 파일을 채웁니다.
server {
listen 80;
listen [::]:80;
root /var/www/xcart;
index index.php index.html index.htm;
server_name example.com;
location @handler {
index cart.php;
rewrite ^/sitemap.xml(\?.+)?$ /cart.php?target=sitemap;
rewrite ^/(.*)$ /cart.php?url=$1 last;
}
location / {
try_files $uri $uri/ @handler;
}
location ~ \.php$ {
try_files $uri @handler;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
파일을 sites-enabled
디렉토리에 연결하여 새 xcart.conf
구성을 활성화합니다.
sudo ln -s /etc/nginx/sites-available/xcart.conf /etc/nginx/sites-enabled
구성을 테스트합니다.
sudo nginx -t
Nginx를 다시 로드합니다.
sudo systemctl reload nginx
5단계 - X-Cart 설치
/var/www
디렉토리로 이동합니다.
cd /var/www/
https://www.x-cart.com/download.html에서 최신 X-Cart 릴리스를 다운로드하고 문서 루트에 압축을 풉니다.
다운로드 후 /var/www/xcart
디렉토리의 소유권을 www-data:
로 변경합니다.
sudo chown -R www-data:www-data /var/www/xcart
웹 브라우저에서 example.com/install.php
로 이동하고 지침에 따라 설치를 완료합니다.
6단계 - 설정 완료
라이선스 계약에 동의하고 다음을 클릭합니다.
관리자 계정을 만듭니다.
설치 마법사는 서버가 X-Cart 5의 시스템 요구 사항을 충족하는지 확인합니다.
데이터베이스 설정 구성:
디렉터리 설정 + 6단계. 캐시 구축. 이 단계의 모든 작업은 완전히 자동화되어 있으므로 X-Cart 5가 작업을 수행하도록 기다리기만 하면 됩니다.
이제 설치 과정이 완료되었습니다. 제공된 링크를 사용하여 매장의 고객 프런트 엔드 및 관리 영역에 액세스할 수 있습니다.