安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装PHP
brew install php
php.ini 以及 php-fpm.ini 保存路径:
/usr/local/etc/php/7.x/
启动PHP服务
brew services start php
安装MySQL
由于MySQL 8 改动太大,加上对MySQL 8 不熟悉,我选择按装MySQL 5.7的版本
brew install mysql@5.7
启动MySQL
brew services start mysql@5.7
安装Nginx
brew install nginx
启动Nginx
brew services start nginx
安装Redis
brew install redis
启动Redis
brew services start redis
安装MongoDB
brew install mongodb
启动MongoDB
brew services start mongodb
安装PHP扩展
pecl install mongodb
pecl install redis
安装 composer nodejs
brew install composer
brew install node
添加Nginx vhost
test.conf
cd /usr/local/etc/nginx/servers
vim test.conf
server {
listen 80;
server_name localhost;
root /Users/w/PhpstormProjects/untitled;
index index.html index.htm index.php;
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ /.well-known {
allow all;
}
location ~ /\. {
deny all;
}
}