一.安装go 到 /usr/local/go/bin
vim ~/.bash_profile
export GOPATH=/Users/mac/program/Go
source ~/.bash_profile
go env
https://www.cnblogs.com/wjaaron/p/11422159.html
二.mysql 安装
brew install mysql
mysql.server start
mysql.server stop
三.nginx 安装(8080)
默认代码目录
/usr/local/var/www/
brew install nginx
nginx 启动
pkill nginx 关闭
/usr/local/etc/nginx/nginx.conf (配置文件路径)
/usr/local/var/www (服务器默认路径)
/usr/local/Cellar/nginx/1.19.0 (安装路径)
1. sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf
2. /private/etc/php-fpm.conf
3. error_log = /usr/local/var/log/php-fpm.log
sudo php-fpm 报错
Nothing matches the include pattern ‘/private/etc/php-fpm.d/*.conf’ from /private/etc/php-fpm.conf at line 125 解决:
cd /private/etc/php-fpm.d
sudo cp www.conf.default www.conf
修改配置
1.打开 nginx.config 文件 /usr/local/etc/nginx/nginx.conf
2.找到 server 的 location 配置,给 index 加一个 index.php
location / {
root html;
index index.html index.htm index.php;
}
3.并打开 server 下被注释的 location ~.php$(即删除代码前面的 ‘#'),如下
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
4.并修改 fastcgi_param 参数
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
改为 :
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
修改 nginx.conf 后,重载配置文件
sudo nginx -s reload
停止 nginx 服务器
sudo nginx -s stop
https://www.jianshu.com/p/11e4e6726346
http://www.cppcns.com/jiqiao/fuwuqi/179155.html
小结:
开启mysql
mysql.server start
开启nginx
nginx
开启php-fpm
sudo php-fpm