サボって、EC2のサーバーにいちいちファイルをアップロード動かしてましたが、エラーが解決できず面倒になってきたので、ローカルで動かすことにする。
でも、さぼって、vagrant は使わずに、直にnginxを動かす。
$ brew install nginx
$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/opt/php@7.2/homebrew.mxcl.php@7.2.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist
$ sudo vi /usr/local/etc/nginx/nginx.conf
listen 8080;
server_name localhost;
location / {
#root html;
root ドキュメントルート;
index index.php index.html index.htm;
}
location ~ \.php$ {
root ドキュメントルート;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
$ sudo nginx -s reload
nginx.confのlistenとserver_nameの通りにブラウザで開く。
http://localhost:8080/index.php
なぜか、index.php付けないと動かず
mysqlもインストールします。
$ brew install mysql
$ brew services start mysql