1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS EC2でEC-CUBEを超簡単に構築

Last updated at Posted at 2022-09-24

前提

AWS EC2の1台のみで構築
1台だけなのでネットワーク系の設定は説明を省略します
EC-CUBEは「eccube-4.1.2.zip」を使用、予め/home/ec2-user/配下に保管

1. EC2の初期設定

sudo su -
echo (hostname) > /etc/hostname
timedatectl set-timezone Asia/Tokyo
yum update -y
shutdown -r now

2. Appacheインストール

sudo su -
yum install httpd -y
amazon-linux-extras list
amazon-linux-extras install php7.4
php -v
systemctl status httpd
systemctl start httpd
systemctl status httpd
#ブラウザでテストページが表示されることを確認

3. MariaDBインストール

###パスワード、ユーザ名などは任意のものを使用すること
yum install -y mariadb mariadb-server
systemctl status mariadb
systemctl start mariadb
systemctl status mariadb
mysql_secure_installation
#パスワード設定など
mysql -uroot -p
>show databases;
>show tables from mysql;
>select host,user,password from mysql.user;
>create database eccube;
>show databases;
>grant all privileges on eccube.* to eccube_user@localhost identified by 'password';
>select host,user,password from mysql.user;
>exit
mysql -ueccube_user -ppassowrd
>show databases;
>show tables from eccube;
exit

4. EC-CUBEコンテンツファイル準備

cd /var/www/
cp -a /home/ec2-user/eccube-4.1.2.zip ./
ls -l
unzip eccube-4.1.2.zip 

5. httpd.conf編集

cd /etc/httpd/conf/
cp httpd.conf httpd.conf-org
vi httpd.conf
diff httpd.conf-org httpd.conf

- DocumentRoot "/var/www/html"
+ DocumentRoot "/var/www/ec-cube"

-  <Directory "/var/www">
-      AllowOverride None
+  <Directory "/var/www/ec-cube">
+      AllowOverride All

systemctl restart httpd
yum install -y php-pgsql php-pdo php-phar php-mbstring php-zlib php-ctype php-session php-json php-xml php-libxml openssl php-zip curl php-fileinfo php-intl
systemctl restart httpd

6. ブラウザで表示確認、GUI設定へ

GUI設定が完了すれば使用可能

6.1 「mod_rewriteが有効になっているか不明です」と表示される場合

念の為確認
mod_rewriteはhttpd.confがec-cube/.htaccessで設定するもの。

cat httpd.conf | grep mod_rewrite
# 表示結果なし

cat ec-cube/.htaccess | grep mod_rewrite
 <IfModule mod_rewrite.c>

less ec-cube/.htaccess 
 RewriteEngine On

有効になっていることが確認できたので画面のメッセージは無視して大丈夫でした。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?