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

Nginx、PHP-FPM、MariaDBを使用してCentOS7にMagentoをインストールします

Magentoは非常に人気があり、機能が豊富なオープンソースのeコマースWebアプリケーションです。 Magentoは、ユーザーの要件を満たすように完全にカスタマイズ可能であり、完全に機能するオンラインストアを数分で作成して起動できます。このチュートリアルでは、Nginx Webサーバー、PHP-FPM、MariaDBを使用してCentOS7VPSにMagentoをインストールする方法を示します。

いつものように、ユーザーrootとしてサーバーにログインし、CentOS7VPSが完全に最新であることを確認します

yum -y update

Magentoにはデータベースが必要なので、MariaDBサーバーをインストールし、ストア用に空のデータベースを作成します

yum install mariadb mariadb-server

MariaDBサーバーを起動し、起動時に起動できるようにします

systemctl start mariadb
systemctl enable mariadb

インストール後のmysql_secure_installationスクリプトを実行して、MariaDBサーバーのセキュリティを向上させ、ルートパスワードを設定します。

次に、MariaDBサーバーコンソールにログインしてデータベースを作成します

mysql -u root -p
mysql> CREATE DATABASE magentodb;
mysql> GRANT ALL PRIVILEGES ON magentodb . * TO magentouser@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;

PASSWORDを実際の強力なパスワードに変更することを忘れないでください。

次に、NginxWebサーバーをインストールします。 CentOS 7ではデフォルトで使用できないため、公式のNginxリポジトリを使用します

rpm -UVh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx

Nginx Webサーバーを起動し、起動時に起動できるようにします

systemctl start nginx
systemctl enable nginx

PHPといくつかのPHPモジュールをインストールする

yum install php php-fpm php-cli php-mysql php-curl php-gd

次に、Magentoの公式Webサイトにアクセスして、最新の安定バージョンをダウンロードします。この記事を書いている時点では、バージョン1.9.1.0です

wget http://www.magentocommerce.com/downloads/assets/1.9.1.0/magento-1.9.1.0.tar.gz

Magentoアーカイブをサーバーのドキュメントルートディレクトリに解凍します

tar -xvzf magento-1.9.1.0.tar.gz -C /var/www/html/
rm magento-1.9.1.0.tar.gz

アーカイブのコンテンツは、ドキュメントルート内の新しい「magento」ディレクトリに解凍されます。

適切な権限を設定する:

cd /var/www/html/magento
chmod -R o+w app/etc/
chmod -R o+w var/
chmod -R o+w media/

次のコンテンツを使用して、ドメインのNginx仮想ブロックを作成します

nano /etc/nginx/conf.d/magentodomain.conf

server {
listen 80 default;
server_name www.magentoodomain.com *.magentoodomain.com;
root /var/www/html/magento

location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}

location ^~ /app/                { deny all; }
location ^~ /includes/           { deny all; }
location ^~ /lib/                { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/            { deny all; }
location ^~ /report/config.xml   { deny all; }
location ^~ /var/                { deny all; }

location /var/export/ {
auth_basic           "Restricted";
auth_basic_user_file htpasswd;
autoindex            on;
}

location  /. {
return 404;
}

location @handler {
rewrite / /index.php;
}

location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}

location ~ .php$ {
if (!-e $request_filename) { rewrite / /index.php last; }

expires        off;
fastcgi_pass   127.0.0.1:9000;
fastcgi_param  HTTPS $fastcgi_https;
fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
fastcgi_param  MAGE_RUN_CODE default;
fastcgi_param  MAGE_RUN_TYPE store;
include        fastcgi_params; ## See /etc/nginx/fastcgi_params
}
}
を参照してください

magentoodomain.comのすべてのインスタンスを独自のドメイン名に置き換えます。変更を有効にするためにNginxを再起動します。

systemctl restart nginx

コマンドラインのインストールが完了しました。次に、http://magentodomain.comにアクセスしてWebベースのMagentoインストーラーを起動し、インストールを完了するために必要な手順を完了します

もちろん、Linux VPSホスティングサービスのいずれかを使用している場合は、これを行う必要はありません。その場合は、専門のLinux管理者にMagentoのインストールを依頼するだけです。彼らは24時間年中無休で利用可能であり、あなたの要求をすぐに処理します。 CentOS8にMagento2をインストールする方法に関するガイドもご覧ください。

PS。 この投稿が気に入った場合は、左側のボタンを使用してソーシャルネットワーク上の友達と共有するか、下に返信を残してください。ありがとう。


Cent OS
  1. Nginx、MariaDB、PHP-FPMを使用してCentOS7VPSにVarnishとphpMyAdminをインストールする方法

  2. NginxとPHP-FPMを使用してCentOS7VPSにFluxBBをインストールします

  3. NginxとPHP-FPMを使用してCentOS7VPSにeZPublishCommunityProjectをインストールします

  1. CentOS8にNginxとPHP7.3でNextcloudをインストールする方法

  2. CentOS7にNginxとMariaDBを使用してownCloud9.1をインストールする方法

  3. Nginxを使用してCentOS8にLet'sEncryptをインストールする方法

  1. CentOS7にHHVMとNginxを使用してWordPressをインストールする方法

  2. CentOS7にNginxとPHP7-FPMを使用してNextcloudをインストールする方法

  3. CentOS7にMagento2.1をインストールする方法