Apache로 PrestaShop을 설치하고 CentOS 8에서 SSL을 암호화하는 방법
이 페이지에서
- 전제 조건
- LAMP 서버 설치
- PrestaShop용 데이터베이스 만들기
- PrestaShop 설치
- PrestaShop용 Apache 구성
- 방화벽 구성\n
- PrestaShop에 액세스
- Lets Encrypt SSL로 안전한 PrestaShop\n
- 결론
PrestaShop은 온라인 비즈니스를 만들고 관리하는 데 사용되는 PHP로 작성된 오픈 소스 장바구니입니다. 최소한의 시간에 온라인 상점을 시작하는 데 도움이 되는 간단하고 사용하기 쉬운 인터페이스를 제공합니다. 사용자 친화적인 인터페이스, 여러 결제 게이트웨이(PayPal, Google Checkout), 모바일 반응형 디자인, 무료 지원, 다국어, 분석, 보고 등 많은 기능을 제공합니다.
이 게시물에서는 Apache와 함께 PrestaShop을 설치하는 방법과 CentOS 8에서 무료 Lets Encrypt SSL 인증서를 보여줍니다.
전제 조건
- CentOS 8을 실행하는 서버.\n
- 서버 IP를 가리키는 유효한 도메인 이름입니다.\n
- 서버에 루트 암호가 구성되어 있습니다.\n
램프 서버 설치
시작하기 전에 LAMP 서버가 서버에 설치되어 있어야 합니다. 설치되지 않은 경우 다음 명령을 사용하여 다른 PHP 확장과 함께 설치할 수 있습니다.
dnf install httpd mariadb-server php php-cli php-bcmath php-mysqli php-gd php-pdo php-xmlrpc php-intl php-posix php-json php-curl php-zip unzip -y
필요한 모든 패키지를 설치한 후 php.ini 파일을 편집하고 일부 기본 설정을 변경합니다.
nano /etc/php.ini
다음 줄을 변경합니다.
max_input_vars = 3000 post_max_size = 64M upload_max_filesize = 64M max_execution_time = 600 memory_limit = 256M date.timezone = Asia/Kolkata
파일을 저장하고 닫은 다음 Apache 및 MariaDB 서비스를 시작하고 시스템 재부팅 시 시작할 수 있도록 활성화합니다.
systemctl start httpd
systemctl start mariadb
systemctl enable httpd
systemctl enable mariadb
이 시점에서 LAMP 서버가 서버에 설치됩니다.
PrestaShop용 데이터베이스 생성
PrestaShop은 MySQL/MariaDB 데이터베이스를 사용하여 데이터를 저장합니다. 따라서 PrestaShop에 대한 데이터베이스와 suer를 생성해야 합니다.
먼저 다음 명령을 사용하여 MariaDB에 로그인합니다.
mysql
로그인 후 다음 명령을 사용하여 데이터베이스와 사용자를 생성합니다.
MariaDB [(none)]> CREATE DATABASE prestashopdb;
MariaDB [(none)]> CREATE USER 'prestashopuser'@'localhost' IDENTIFIED BY 'securepassword';
그런 다음 다음 명령을 사용하여 prestashopdb에 모든 권한을 부여합니다.
MariaDB [(none)]> GRANT ALL PRIVILEGES ON prestashopdb. * TO 'prestashopuser'@'localhost';
다음으로 다음 명령을 사용하여 권한을 플러시하고 MariaDB를 종료합니다.
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
완료되면 다음 단계로 진행할 수 있습니다.
프레스타샵 설치
다음으로 공식 다운로드 페이지에서 최신 버전의 PrestaShop을 다운로드해야 합니다. 다음 명령으로 다운로드할 수 있습니다.
wget https://download.prestashop.com/download/releases/prestashop_1.7.7.3.zip
다운로드가 완료되면 다음 명령을 사용하여 다운로드한 파일을 Apache 웹 루트 디렉터리에 압축 해제합니다.
unzip prestashop_1.7.7.3.zip -d /var/www/html/prestashop
그런 다음 다음 명령을 사용하여 prestashop 디렉토리에 적절한 소유권을 설정합니다.
chown -R apache:apache /var/www/html/prestashop
완료되면 다음 단계로 진행할 수 있습니다.
PrestaShop용 Apache 구성
다음으로 PrestaShop용 Apache 가상 호스트 구성 파일을 생성해야 합니다. 다음 명령으로 만들 수 있습니다.
nano /etc/httpd/conf.d/prestashop.conf
다음 줄을 추가합니다.
<VirtualHost *:80> ServerAdmin ServerName prestashop.example.com DocumentRoot /var/www/html/prestashop <Directory /var/www/html/prestashop> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog /var/log/httpd/prestashop-error_log CustomLog /var/log/httpd/prestashop-access_log common </VirtualHost>
완료되면 파일을 저장하고 닫습니다. 다음으로 Apache 서비스를 다시 시작하여 변경 사항을 적용합니다.
systemctl restart httpd
다음으로 다음 명령을 사용하여 Apache 서비스의 상태를 확인합니다.
systemctl status httpd
다음과 같은 결과가 표시되어야 합니다.
? httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/httpd.service.d ??php-fpm.conf Active: active (running) since Wed 2021-04-07 01:04:19 EDT; 2h 2min ago Docs: man:httpd.service(8) Main PID: 47841 (httpd) Status: "Total requests: 313; Idle/Busy workers 100/0;Requests/sec: 0.0425; Bytes served/sec: 1.2KB/sec" Tasks: 278 (limit: 12524) Memory: 35.9M CGroup: /system.slice/httpd.service ??47841 /usr/sbin/httpd -DFOREGROUND ??47843 /usr/sbin/httpd -DFOREGROUND ??47844 /usr/sbin/httpd -DFOREGROUND ??47845 /usr/sbin/httpd -DFOREGROUND ??47846 /usr/sbin/httpd -DFOREGROUND ??48061 /usr/sbin/httpd -DFOREGROUND Apr 07 01:04:19 centos8 systemd[1]: Stopped The Apache HTTP Server. Apr 07 01:04:19 centos8 systemd[1]: Starting The Apache HTTP Server...
완료되면 다음 단계로 진행할 수 있습니다.
방화벽 구성
다음으로 방화벽을 통해 포트 80 및 443을 허용해야 합니다. 다음 명령으로 허용할 수 있습니다.
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
다음으로 방화벽을 다시 로드하여 변경 사항을 적용합니다.
firewall-cmd --reload
완료되면 다음 단계로 진행할 수 있습니다.
PrestaShop에 액세스
이제 웹 브라우저를 열고 URL http://prestashop.example.com을 사용하여 PrestaShop 웹 인터페이스에 액세스하십시오. 다음 페이지로 리디렉션됩니다.


언어를 선택하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

라이선스 계약에 동의하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.


상점 이름, 국가 정보, 계정 정보를 입력하고 다음 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

데이터베이스 이름, 데이터베이스 사용자 이름, 비밀번호를 제공하고 다음 버튼을 클릭합니다. 설치가 완료되면 다음 페이지가 표시됩니다.

스토어 관리 버튼을 클릭합니다. 다음 페이지가 표시됩니다.

이제 다음 명령을 사용하여 설치 폴더를 제거하십시오.
rm -rf /var/www/html/prestashop/install
그런 다음 PrestaShop 관리자 URL을 클릭합니다. 다음 페이지가 표시됩니다.

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

Lets Encrypt SSL로 안전한 PrestaShop
다음으로 Lets Encrypt SSL for PrestaShop을 설치하려면 Certbot 클라이언트를 설치해야 합니다. 다음 명령으로 설치할 수 있습니다.
dnf install letsencrypt python3-certbot-apache
그런 다음 다음 명령을 사용하여 lets 도메인에 대한 SSL 인증서를 가져와 설치합니다.
certbot --apache -d prestashop.example.com
이메일 주소를 제공하고 서비스 약관에 동의하라는 메시지가 표시됩니다.
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. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, 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 Account registered. Requesting a certificate for prestashop.example.com Performing the following challenges: http-01 challenge for prestashop.example.com Waiting for verification. Cleaning up challenges Deploying Certificate to VirtualHost /etc/httpd/conf.d/prestashop.conf Redirecting all traffic on port 80 to ssl in /etc/httpd/conf.d/prestashop.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://prestashop.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Subscribe to the EFF mailing list (email: ). IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/prestashop.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/prestashop.example.com/privkey.pem Your certificate will expire on 2021-06-09. 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 리디렉션을 사용하여 웹사이트에 안전하게 액세스할 수 있습니다. 여기를 확인하세요.
결론
축하합니다! Apache와 함께 PrestaShop을 성공적으로 설치했으며 CentOS 8에서 SSL을 암호화합니다. 이제 제품을 PrestaShop에 추가하고 온라인 판매를 시작할 수 있습니다. 궁금한 점이 있으면 언제든지 문의해 주세요.