LoginSignup
0
0

More than 1 year has passed since last update.

php artisan serveを使わずにブラウザでLaravelアプリを起動する

Posted at

毎回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アプリフォルダの下にあるstoragebootstrap/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

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