mokoti / mpp_laravel_react_spa

0 stars 0 forks source link

仮想サーバでの動作 #1

Open mokoti opened 2 years ago

mokoti commented 2 years ago

bootstrap.shに実行内容メモしてます https://qiita.com/yuichi1992_west/items/5f3718ab6e4c92c8b238

それ以降の作業について

isuconユーザのようにappで稼働させるautochessユーザーを作成

adduser autochess

systemdでサービスを稼働させるように設定

# 設定ファイルと起動スクリプトを新規作成
sudoedit /etc/systemd/system/autochess.service
vi /home/autochess/scripts/boot.sh

# サービスが動く
systemctl start autochess.service

document rootにアプリケーションファイルを設置

https://utsu-programmer.com/environment/laravel-setting-public/

# 必要であれば書き換えるが、今回はsymlinkを貼ることで対応したので不要の認識
vi /etc/httpd/conf/httpd.conf

403で表示されないので

/var/log/httpd/error_logでエラー内容を調査 → docrootの指定が間違えていただけでした、docroot直下にindex〜が必要

confを書き換えておく

vi /etc/httpd/conf/httpd.conf
systemctl restart httpd
< DocumentRoot "/var/www/html/webapp/public"
---
> DocumentRoot "/var/www/html"
131c131
< <Directory "/var/www/html/webapp/public">
---
> <Directory "/var/www/html">
151c151
<     AllowOverride All
---
>     AllowOverride None

frameworkでエラーに変わったので解決していく

chmod 777 bootstrap/cache
chmod 777 storage/app/public
chmod 777 storage/framework/cache
chmod 777 storage/framework/sessions
chmod 777 storage/framework/views
chmod 777 storage/logs

キャッシュファイルが空にして一度キャッシュファイルを生成すると、2回目移行のロードでパーミッションエラーになる

一旦そのセッションファイルを777にして回避、根本では自動で作られるファイルが777になるようにすべきか?
chmod 777 /vagrant/data/webapp/storage/framework/sessions/g8DX9IruZZf39VxxtJENbAigRUM1cmrjdreCVnb6

mokoti commented 2 years ago

mysql

autochessユーザーの作成

CREATE USER 'autochess'@'localhost';
GRANT ALL PRIVILEGES ON autochess.* TO autochess@localhost IDENTIFIED BY 'autochess' WITH GRANT OPTION;

autochess データベースの作成

create database autochess;

テーブル作り忘れてたのでいれる

php artisan make:migration create_users_table
# テーブル定義編集してからmigrate
php artisan migrare

gitがなかったので入れる

yum -y install git

mariaDB接続ドライバ

yum -y install --enablerepo=remi,remi-php70 php-mysqlnd