0
0

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 3 years have passed since last update.

CakePHPインストール

Last updated at Posted at 2020-03-07

導入先
EC2(amzn2-ami-hvm-2.0.20200207.1-x86_64-gp2)
apache( httpd-2.4.41-1.amzn2.0.1.x86_64.rpm)
php(7.3.14)

apacheユーザを使用したいのでnologinであれば変更

$ sudo su -
# usermod -s /bin/bash apache
# usermod -d /var/www apache

Composer のインストール

# php -r "copy( 'https://getcomposer.org/installer'、 'composer-setup.php');"
特にディレクトリ指定はない
# php composer-setup.php
↓出力
All settings correct for using Composer
Downloading...

Composer (version 1.9.3) successfully installed to: 
${currentdir}/composer.phar
Use it: php composer.phar

カレントディレクトリに2つファイルが生成される
composer.phar
composer-setup.php

composer-setup.phpのみ削除

# php -r "unlink('composer-setup.php');"

コマンド実行したい為PATHが通るディレクトに移動する

# mv composer.phar /usr/local/bin/composer

#CakePHP プロジェクトを作成

例えば
http(s)://hogehoge.co.jp をドメインとする場合

# su - apache
$ cd /var/www/
$ composer self-update && composer create-project --prefer-dist cakephp/app:^3.8 hogehoge.co.jp

バーチャルホスト設定

$ sudo su -
# vim /etc/httpd/conf.d/hogehoge.co.jp.conf
<VirtualHost *:80>
    ServerName hogehoge.co.jp
    CustomLog "logs/hogehoge.co.jp_access_log"
    ErrorLog  "logs/hogehoge.co.jp_error_log"

    DocumentRoot /var/www/hogehoge.co.jp/webroot
    <Directory "/var/www/hogehoge.co.jp/webroot">
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

apache再起動

systemctl stop httpd.service
systemctl start httpd.service

ドメイン設定もろもろしたらhogehoge.co.jpにアクセス
以下画面がでれば準備完了
WS000004.JPG

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?