GNU/Linux >> Linux の 問題 >  >> Cent OS

Apacheを使用してPrestaShopをインストールし、CentOS8でSSLを暗号化する方法

PrestaShopは、オンラインビジネスの作成と管理に使用されるPHPで記述されたオープンソースのショッピングカートです。それはあなたが最小の時間であなたのオンラインストアを立ち上げるのを助けるシンプルで使いやすいインターフェースを提供します。ユーザーフレンドリーなインターフェース、複数の支払いゲートウェイ(PayPal、Google Checkout)、モバイルレスポンシブデザイン、無料サポート、多言語、分析、レポートなど、多くの機能を提供します。

この投稿では、Apacheを使用してPrestaShopをインストールする方法と、CentOS8に無料のLet'sEncryptSSL証明書をインストールする方法を紹介します。

前提条件
  • CentOS8を実行しているサーバー。
  • サーバーIPで指定された有効なドメイン名。
  • ルートパスワードはサーバーで構成されています。

LAMPサーバーをインストールする

開始する前に、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をインストール

次に、PrestaShopの最新バージョンを公式ダウンロードページからダウンロードする必要があります。次のコマンドでダウンロードできます:

wget https://download.prestashop.com/download/releases/prestashop_1.7.7.3.zip

ダウンロードが完了したら、次のコマンドを使用して、ダウンロードしたファイルをApacheWebルートディレクトリに解凍します。

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 [email protected]
    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

次に、Webブラウザーを開き、URL http://prestashop.example.comを使用してPrestaShopWebインターフェースにアクセスします。 。次のページにリダイレクトされます:

言語を選択して、次へをクリックします ボタン。次のページが表示されます:

使用許諾契約に同意し、次へをクリックします ボタン。次のページが表示されます:

ショップ名、国情報、アカウント情報を入力して、次へをクリックします ボタン。次のページが表示されます:

データベース名、データベースユーザー名、パスワードを入力し、次へをクリックします ボタン。インストールが完了すると、次のページが表示されます。

ストアの管理をクリックします ボタン。次のページが表示されます:

次に、次のコマンドを使用してインストールフォルダを削除します。

rm -rf /var/www/html/prestashop/install

次に、PrestaShop管理者URLをクリックします 。次のページが表示されます:

管理者のユーザー名とパスワードを入力し、ログインをクリックします ボタン。次のページにPrestaShopダッシュボードが表示されます。

SSLを暗号化してLet'sで安全なPrestaShop

次に、Certbotクライアントをインストールして、Let's Encrypt SSLforPrestaShopをインストールする必要があります。次のコマンドでインストールできます:

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): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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: [email protected]).


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

これで、URLhttps://prestashop.example.com。を使用してWebサイトに安全にアクセスできます。

結論

おめでとう!これで、Apacheを使用したPrestaShopとLet's EncryptSSLがCentOS8に正常にインストールされました。これで、製品をPrestaShopに追加して、オンラインでの販売を開始できます。ご不明な点がございましたら、お気軽にお問い合わせください。


Cent OS
  1. Nginxを使用してWonderCMSをインストールし、CentOS7でSSLを暗号化する方法

  2. ApacheでAutomadCMSをインストールし、Debian10で暗号化する方法

  3. CentOS7にApacheでLet'sEncryptをインストールする方法

  1. Nginxを使用してWordPressをインストールし、CentOS8でSSLを暗号化する方法

  2. ElkArteフォーラムをApacheでインストールし、Debian10で暗号化する方法

  3. Nginxを使用してDokuWikiをインストールし、CentOS8でSSLを暗号化する方法

  1. CentOS8にNginxとLESSSLを使用してFlarumフォーラムをインストールする方法

  2. ApacheでWonderCMSをインストールし、CentOS8でSSLを暗号化する方法

  3. Nginxを使用してAskbotをインストールし、CentOS8でLetsEncryptを使用して保護する方法