毎回php artisan serve
を使用するのが面倒だったのでメモ
やること
- httpd.confの編集
- 権限の付与
- SELinuxの設定
参考サイト
https://engineers.weddingpark.co.jp/apache-403-forbidden/
httpd.confの編集
/etc/httpd/conf/httpd.conf
の以下の部分を編集
httpd.conf
//編集
LoadModule rewrite_module modules/mod_rewrite.so //コメントアウト解除 & rewrite_moduleの設定
//追記
<Directory "/var/www/html/作成したlaravelプロジェクト名/public" >
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Directoryに関しては/var/www/html
を同様に編集にしてもOK
権限の付与
作成したlaravelアプリフォルダの下にあるstorage
とbootstrap/cache
への編集権限を与える
$ chmod -R 777 storage/ //権限は適宜変更
$ chmod -R 777 bootstrap/cache/ //権限は適宜変更
SELinuxの設定
SELinuxの状態確認
$ getenforce
Enforcing //有効になっている場合
Disabled //無効になっている場合
SELinuxを無効にする
$ sudo vi /etc/selinux/config
~
SELINUX=disabled //変更
最後にサーバーの再起動をして確認
URLはhttp://IPアドレス/プロジェクト名/public
例:http://192.168.0.1/laravel/public