前回からのおまけ編としてドキュメントルート以外の場所に設置したLaravelプロジェクトを
動かしてみる
かなり悪戦苦闘したので長丁場になりますw
実際必要な作業は赤字の部分だけとなりますので黒字の部分は飛ばしてもらっても大丈夫です
Aliasのモジュールがあるかどうか確認してみる
apache設定ファイルに間違いがないかチェック
再度エイリアス設定を確認する
権限設定
Apacheのエラーを見てみる
SELinuxを無効化
サブディレクトリに設置したLaravelプロジェクトへのアクセス設定
Laravelプロジェクト以下の不足しているファイルを補強する
php-xmlをインストール
Laravelプロジェクトの.envファイルを設置
Laravelプロジェクト以下にapacheがアクセスできるようにする
Apacheのエイリアス設定
プロジェクトフォルダの位置にアクセスできるようにする
「httpd.conf」ファイルの中に<IfModule alias_module>と書かれている部分に移動
そのタグ内に以下追記する
Alias /laravel/ “/vagrant/git_my_shared/public/”
<Directory “/vagrant/git_my_shared/public/”>
Require all granted
</Directory>
またモジュールの追加設定も追記
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule’ lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l’) do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
Include conf.modules.d/*.conf
#alias setting
LoadModule authn_alias_module modules/mod_authn_alias.so
# Example:
# LoadModule foo_module modules/mod_foo.so
#
Include conf.modules.d/*.conf
#alias setting
LoadModule alias_module modules/mod_alias.so
念のためapache再起動
[root@localhost ~]# systemctl restart httpd
http://192.168.33.10/laravelに接続してみる
あれ?うまくいかない・・・
Aliasのモジュールがあるかどうか確認してみる
apacheにインストールされているをHttpコマンドで確認してみる
Httpコマンドについてはこちらを参照
[root@localhost ~]# httpd -l
Compiled in modules:
core.c
mod_so.c
http_core.c
静的に組み込まれたモジュールにはmod_alias.cがないね
次に見るべきはDSO(動的共有オブジェクト:Dynamic Shared Object)モジュール
[root@localhost ~]# httpd -M
[Fri Aug 04 10:55:23.922772 2017] [so:warn] [pid 2657] AH01574: module alias_module is already loaded, skipping
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName’ directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
allowmethods_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
authn_anon_module (shared)
authn_core_module (shared)
authn_dbd_module (shared)
authn_dbm_module (shared)
authn_file_module (shared)
authn_socache_module (shared)
authz_core_module (shared)
authz_dbd_module (shared)
authz_dbm_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_owner_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cache_module (shared)
cache_disk_module (shared)
data_module (shared)
dbd_module (shared)
deflate_module (shared)
dir_module (shared)
dumpio_module (shared)
echo_module (shared)
env_module (shared)
expires_module (shared)
ext_filter_module (shared)
filter_module (shared)
headers_module (shared)
include_module (shared)
info_module (shared)
log_config_module (shared)
logio_module (shared)
mime_magic_module (shared)
mime_module (shared)
negotiation_module (shared)
remoteip_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
slotmem_plain_module (shared)
slotmem_shm_module (shared)
socache_dbm_module (shared)
socache_memcache_module (shared)
socache_shmcb_module (shared)
status_module (shared)
substitute_module (shared)
suexec_module (shared)
unique_id_module (shared)
unixd_module (shared)
userdir_module (shared)
version_module (shared)
vhost_alias_module (shared)
dav_module (shared)
dav_fs_module (shared)
dav_lock_module (shared)
lua_module (shared)
mpm_prefork_module (shared)
proxy_module (shared)
lbmethod_bybusyness_module (shared)
lbmethod_byrequests_module (shared)
lbmethod_bytraffic_module (shared)
lbmethod_heartbeat_module (shared)
proxy_ajp_module (shared)
proxy_balancer_module (shared)
proxy_connect_module (shared)
proxy_express_module (shared)
proxy_fcgi_module (shared)
proxy_fdpass_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_scgi_module (shared)
proxy_wstunnel_module (shared)
systemd_module (shared)
cgi_module (shared)
php7_module (shared)
[root@localhost ~]#
あるし問題ないっぽい
apache設定ファイルに間違いがないかチェック
[root@localhost git_my_shared]# apachectl configtest
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName’ directive globally to suppress this message
Syntax OK
サーバー名の設定をしてないというだけのエラーなので特別問題なし
再度エイリアス設定を確認する
もう一度httpd.confで設定したエイリアス設定を見てみる
Alias /laravel/ “/vagrant/git_my_shared/public/”
<Directory “/vagrant/git_my_shared/public/”>
Require all granted
</Directory>
/laravel/の末尾のスラッシュっているのかな・・・
と調べてみると自動で末尾にスラッシュを保管するらしく末尾にスラッシュがあると
//となってダメみたい
なので/laravelとしてみるとエラー内容が変わった
Alias /laravel “/vagrant/git_my_shared/public/”
<Directory “/vagrant/git_my_shared/public/”>
Require all granted
</Directory>
アクセスURL:
http://192.168.33.10/laravel/
not foundからforbidden
おそらくlaravelのプロジェクトフォルダの権限がapacheにないので起こってるかと
権限設定
なので権限周りを調整
apacheユーザーをvagrantグループに加える
[root@localhost ~]# usermod -G vagrant apache
[root@localhost ~]# getent group vagrant
vagrant:x:1000:vagrant,apache
やってみたがダメ
apache起動ユーザーを変えてみる
まずは現状の起動ユーザーの確認
$ ps aux | grep http
apacheになってる
/etc/httpd/conf/httpd.confで
UserとGroupの指定をapacheからvagrantに変えた
User apache
Group apache
⇒
User vagrant
Group vagrant
apacheを再起動してみるがダメ
Laravelのプロジェクトフォルダをすべて777にしてみる
chmod -R 777 ディレクトリ
再度確認してみるがだめ
Apacheのエラーを見てみる
ここでapacheのエラーを見るのを忘れてた
見てみると・・・
[Mon Aug 07 09:39:08.875766 2017] [autoindex:error] [pid 6265] [client 192.168.33.1:57582] AH01276: Cannot serv
e directory /vagrant/: No matching DirectoryIndex (index.html,index.php) found, and server-generated directory
index forbidden by Options directive
エイリアスに設定したディレクトリにindex.phpがなかったな
なのでエイリアスを設定したディレクトリの階層を一つ上にしてそこにindex.phpを作ってみた
再度確認してみると以下のエラーが
[Mon Aug 07 09:40:16.182234 2017] [:error] [pid 6264] [client 192.168.33.1:57588] PHP Warning: Unknown: failed
to open stream: Permission denied in Unknown on line 0
[Mon Aug 07 09:40:16.182328 2017] [:error] [pid 6264] [client 192.168.33.1:57588] PHP Fatal error: Unknown: Fa
iled opening required ‘/vagrant/index.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in Unknown on line
0
pearって書いてあるけどpearって入ってるっけ?
[root@localhost vagrant]# pear
bash: pear: command not found
入ってないね
でもこれみるとpearは関係なさそう
SELinuxを無効化
探してると他にこんな記事が
さっそく以下実行
$ setenforce 0
特に何も反応なかったがURLを叩くとアクセス成功
どうやらSELinuxっていうアクセス制御機能が原因だったらしい
ちなみに以下のようなapacheエラーが出る場合もSELinuxが原因
[Mon Aug 06 01:57:11.671051 2018] [core:crit] [pid 3029] (13)Permission denied: [client 192.168.33.1:62718] AH00529: /vagrant/git_my_shared/public/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/vagrant/git_my_shared/public/’ is executable
こちらの記事も参考にして再起動してもSELinuxが無効になる状態になるよう設定する
vi /etc/selinux/config
で編集し
SELINUX=disabled
とする
apachectl restart
でapache再起動すると設定が反映される
アクセスには成功したがブラウザでこんなエラーが出た
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
サブディレクトリに設置したLaravelプロジェクトへのアクセス設定
この件はこれで対処できそう
alias.conf
Alias /laravel/ “/vagrant/git_my_shared/public/”
<Directory “/vagrant/git_my_shared/public/”>
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
から
Alias /laravel “/vagrant/git_my_shared/public/”
<Directory “/vagrant/git_my_shared/public/”>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
#Require all granted
</Directory>
public/.htacess
# Redirect Trailing Slashes If Not A Folder…
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteRule ^(.*)/$ /laravel/$1 [L,R=301]
RewriteBase /laravel/
[Tue Aug 08 08:24:56.727605 2017] [:error] [pid 2303] [client 192.168.33.1:62189] PHP Fatal error: require(): Failed opening required ‘/vagrant/git_my_shared/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /vagrant/git_my_shared/bootstrap/autoload.php on line 17
すると今度は500エラー
apacheのエラーログを見てみると
[Tue Aug 08 08:36:14.621408 2017] [:error] [pid 2342] [client 192.168.33.1:62551] PHP Fatal error: require(): Failed opening required ‘/vagrant/git_my_shared/bootstrap/../vendor/autoload.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /vagrant/git_my_shared/bootstrap/autoload.php on line 17
require(/vagrant/git_my_shared/bootstrap/../vendor/autoload.php)
とあるがそんなファイルないぞい
ググるとこんな記事が
Laravelプロジェクト以下の不足しているファイルを補強する
とりあえずcomposerをインストールしてcomposer updateせよとのことなのでやってみる
公式サイトのやり方を参照
[root@localhost ~]# composer –version
bash: composer: command not found
[root@localhost ~]# php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);”
[root@localhost ~]# php -r “if (hash_file(‘SHA384’, ‘composer-setup.php’) === ‘669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”
Installer verified
↑公式サイトからコピペして実行すること
[root@localhost ~]# php composer-setup.php
All settings correct for using Composer
Downloading…
Composer (version 1.4.3) successfully installed to: /root/composer.phar
Use it: php composer.phar
[root@localhost ~]# pwd
/root
[root@localhost ~]# php -r “unlink(‘composer-setup.php’);”
[root@localhost ~]# ls
anaconda-ks.cfg composer.phar original-ks.cfg
どこでもcomposerを使えるようにするため
[root@localhost ~]# mv composer.phar /usr/local/bin/composer
[root@localhost ~]# ls
anaconda-ks.cfg original-ks.cfg
確認
[vagrant@localhost public]$ composer –version
Composer version 1.4.3 2017-08-06 15:00:25
composerがインストールできたらcomposer.jsonがある場所で
composer updateを実行してみる
[vagrant@localhost git_my_shared]$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
– phpunit/phpunit 5.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.20 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.19 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.18 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.17 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.16 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.15 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.14 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.13 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.12 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.11 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.10 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– phpunit/phpunit 5.7.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
– Installation request for phpunit/phpunit ~5.7 -> satisfiable by phpunit/phpunit[5.7.0, 5.7.1, 5.7.10, 5.7.11, 5.7.12, 5.7.13, 5.7.14, 5.7.15, 5.7.16, 5.7.17, 5.7.18, 5.7.19, 5.7.2, 5.7.20, 5.7.21, 5.7.3, 5.7.4, 5.7.5, 5.7.6, 5.7.7, 5.7.8, 5.7.9].
To enable extensions, verify that they are enabled in your .ini files:
– /etc/php.ini
– /etc/php.d/20-bz2.ini
– /etc/php.d/20-calendar.ini
– /etc/php.d/20-ctype.ini
– /etc/php.d/20-curl.ini
– /etc/php.d/20-exif.ini
– /etc/php.d/20-fileinfo.ini
– /etc/php.d/20-ftp.ini
– /etc/php.d/20-gd.ini
– /etc/php.d/20-gettext.ini
– /etc/php.d/20-iconv.ini
– /etc/php.d/20-intl.ini
– /etc/php.d/20-json.ini
– /etc/php.d/20-mbstring.ini
– /etc/php.d/20-mysqlnd.ini
– /etc/php.d/20-pdo.ini
– /etc/php.d/20-phar.ini
– /etc/php.d/20-sockets.ini
– /etc/php.d/20-sqlite3.ini
– /etc/php.d/20-tokenizer.ini
– /etc/php.d/30-mysqli.ini
– /etc/php.d/30-pdo_mysql.ini
– /etc/php.d/30-pdo_sqlite.ini
You can also run `php –ini` inside terminal to see which files are used by PHP in CLI mode.
composerを使うときはrootで使わないよう気をつける
しかしエラーは変わらず
composer installをしてみる
[vagrant@localhost git_my_shared]$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
– Installation request for phpunit/php-code-coverage 4.0.8 -> satisfiable by phpunit/php-code-coverage[4.0.
8].
– phpunit/php-code-coverage 4.0.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 2
– Installation request for phpunit/phpunit 5.7.21 -> satisfiable by phpunit/phpunit[5.7.21].
– phpunit/phpunit 5.7.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
– /etc/php.ini
– /etc/php.d/20-bz2.ini
– /etc/php.d/20-calendar.ini
– /etc/php.d/20-ctype.ini
– /etc/php.d/20-curl.ini
– /etc/php.d/20-exif.ini
– /etc/php.d/20-fileinfo.ini
– /etc/php.d/20-ftp.ini
– /etc/php.d/20-gd.ini
– /etc/php.d/20-gettext.ini
– /etc/php.d/20-iconv.ini
– /etc/php.d/20-intl.ini
– /etc/php.d/20-json.ini
– /etc/php.d/20-mbstring.ini
– /etc/php.d/20-mysqlnd.ini
– /etc/php.d/20-pdo.ini
– /etc/php.d/20-phar.ini
– /etc/php.d/20-sockets.ini
– /etc/php.d/20-sqlite3.ini
– /etc/php.d/20-tokenizer.ini
– /etc/php.d/30-mysqli.ini
– /etc/php.d/30-pdo_mysql.ini
– /etc/php.d/30-pdo_sqlite.ini
You can also run `php –ini` inside terminal to see which files are used by PHP in CLI mode.
php extension domとやらがないと言われてる
こちらを参考に確認してみると
該当のdom項目がない
php-xmlをインストール
php extension domはphp-xmlに含まれているらしい
php-xmlをインストールしてみる
[root@localhost ~]# yum install php-xml
再度composer updateをやってみるが変わらず
再度yum install php-xmlを実行してみると以下エラー
Error: Package: php-xml-5.4.16-42.el7.x86_64 (base)
Requires: php-common(x86-64) = 5.4.16-42.el7
Installed: php-common-7.0.22-1.el7.remi.x86_64 (@remi-php70)
php-common(x86-64) = 7.0.22-1.el7.remi
Available: php-common-5.4.16-42.el7.x86_64 (base)
php-common(x86-64) = 5.4.16-42.el7
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest
Problem 1
– Installation request for phpunit/php-code-coverage 4.0.8 -> satisfiable by phpunit/php-code-coverage[4.0.
8].
php-xmlをインストールするにはphp-commonが必要なんだが要求してるのはphp-commonの5.4.16-42.el7
でもインストールされてるのはphp-common-7.0.22-1.el7.remi.x86_64 (@remi-php70)だよって感じ
まずはインストールされているものを確認
yum list installed | grep php-common
アンインストール
yum remove php-common.x86_64
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
php-common x86_64 7.0.22-1.el7.remi @remi-php70 7.9 M
Removing for dependencies:
php x86_64 7.0.22-1.el7.remi @remi-php70 8.3 M
php-cli x86_64 7.0.22-1.el7.remi @remi-php70 13 M
php-devel x86_64 7.0.22-1.el7.remi @remi-php70 8.9 M
php-gd x86_64 7.0.22-1.el7.remi @remi-php70 204 k
php-intl x86_64 7.0.22-1.el7.remi @remi-php70 939 k
php-json x86_64 7.0.22-1.el7.remi @remi-php70 80 k
php-mbstring x86_64 7.0.22-1.el7.remi @remi-php70 2.8 M
php-mysqlnd x86_64 7.0.22-1.el7.remi @remi-php70 888 k
php-pdo x86_64 7.0.22-1.el7.remi @remi-php70 381 k
Transaction Summary
================================================================================
Remove 1 Package (+9 Dependent packages)
Installed size: 43 M
Is this ok [y/N]: y
インストール
yum install php-xml
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php-xml x86_64 5.4.16-42.el7 base 125 k
Installing for dependencies:
libxslt x86_64 1.1.28-5.el7 base 242 k
libzip x86_64 0.10.1-8.el7 base 48 k
php-common x86_64 5.4.16-42.el7 base 564 k
Transaction Summary
================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 980 k
Installed size: 4.7 M
Is this ok [y/d/N]: y
yum install epel-release
再度phpinfo()を実行するプログラムを叩いて確認してみるとdomという項目が
存在することが確認できた
vagrant@localhost git_my_shared]$ composer up
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 66 installs, 0 updates, 0 removals
Failed to download react/promise from dist: The zip extension and unzip command are both missing
, skipping.
The php.ini used by your command-line PHP is: /etc/php.ini
Now trying to download from source
– Installing react/promise (v2.5.1): Cloning 62785ae604
[RuntimeException]
Failed to clone https://github.com/reactphp/promise.git, git was not found, check that it is in
stalled and in your PATH env.
sh: git: command not found
update [–prefer-source] [–prefer-dist] [–dry-run] [–dev] [–no-dev] [–lock] [–no-custom-instal
lers] [–no-autoloader] [–no-scripts] [–no-progress] [–no-suggest] [–with-dependencies] [-v|vv|v
vv|–verbose] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–ignore
-platform-reqs] [–prefer-stable] [–prefer-lowest] [-i|–interactive] [–root-reqs] [–] [<packages>]…
zip,unzipがないと言われたので入れる
yum install -y zip unzip
再度試してみる
vagrant@localhost git_my_shared]$ composer up
するとうまくいった
さっそくLaravelプロジェクトにアクセスしてみる
すると以下のようなエラー
storage/logs/laravel.logを見てみると以下のようなエラー
production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
Laravelプロジェクトの.envファイルを設置
うーん、なんでこんなエラー出るんだろうと思って.envファイルを見てみるとなかったので
前の使っていた.envファイルを持ってくると解決した
.envファイルはlaravelプロジェクト以下に.env.exampleというのがあるのでそれを
cp .env.example .env
などとして.envファイルを作成する
再びブラウザで接続してみて
The only supported ciphers are AES-128-CBC and AES-256-CBC
などと表示されたらこちらを参考にキーを作成するといけるらしい
[vagrant@localhost git_my_shared]$ php artisan key:generate
Application key [base64:5oR+arVBRGXSKbZ8yyDw1xDzUBu45crZPfBug3ANuJo=] set successfully.
[vagrant@localhost git_my_shared]$ php artisan config:clear
Configuration cache cleared!
[vagrant@localhost git_my_shared]$
routeで設定したプログラムを実行してみる
not foundって出る・・・
ルート設定を確認してみる
[vagrant@localhost git_my_shared]$ php artisan route:list
+——–+———-+—————–+——+————————————————
-+————–+
| Domain | Method | URI | Name | Action
| Middleware |
+——–+———-+—————–+——+————————————————
-+————–+
| | GET|HEAD | / | | Closure
| web |
| | GET|HEAD | api/user | | Closure
| api,auth:api |
| | GET|HEAD | controllertest1 | | App\Http\Controllers\testController@testIndex
| web |
| | GET|HEAD | controllertest2 | | App\Http\Controllers\testController@testconnect
| web |
| | GET|HEAD | foo | | App\Http\Controllers\Lists\FooController@index
| web |
| | GET|HEAD | foo/{name} | | App\Http\Controllers\Lists\FooController@index
| web |
| | GET|HEAD | gouttetest | | App\Http\Controllers\testController@testgoutte
| web |
| | GET|HEAD | hello | | Closure | web |
| | GET|HEAD | hello2 | | Closure | web |
+——–+———-+—————–+——+————————————————-+————–+
うーん、問題なさそう
Laravelの設定かなと思い、こちら参考
.htaccessの設定を以下のようにしてみた
apacheを再起動して再度試してみるがダメ
.htaccessの設定が反映されているのか確認
こちらの記事を参考
確認してみると以下のように無効になっていた
# Deny access to the entirety of your server’s filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
Laravelプロジェクト以下にapacheがアクセスできるようにする
アクセス許可したいのはLaravelプロジェクト以下なので以下の記述を最後に追加
#LavavelProject .htaccess setting
<Directory “/vagrant/git_my_shared/”>
AllowOverride All
Require all granted
</Directory>
Apacheを再起動して以下にアクセスしてみるとうまくいった
最後にMySQLのDBに接続できるようにする
以上長い旅は終わり
コメント