分类
电脑软件

Mac 常用软件 + PHP 环境

首先祝大家新年快乐!已经很久没更新了,新的一年新的开始哈哈~

由于电脑装的东西比较杂,希望把 Mac 整得干净些,所以元旦把电脑重置了一下,然后就是必装软件都补上了。列个清单:(主要参考 awesome-mac

临时科学上网方法ssh -fC2qTnN -D 127.0.0.1:9999 -p <22远程端口> user@IP f 后台运行, C 压缩, 2: 版本 2 协议, q 静默模式, T 禁用伪终端分配, n 阻止从 stdin 读取, N 不执行远程命令, D 绑定本地地址, p 端口 默认 22 可不写.

然后在 SwitchyOmega 配置 socks5 127.0.0.1:9999

SSH SOCKS5 代理

然后是 HomeBrew 的安装了,打开链接按提示安装:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 之后配置镜像,要不然每次都会在 brew update 等待:

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git 
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git 
brew update

然后将这句添加到 ~/.profile 里(再在 ~/.zshrc 或 ~/.bashrc 里 加上 source ~/.profile):
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

homebrew 镜像, homebrew bottles 环境变量

接下来安装 Nginx, MySQL, PHP:

brew install php
brew services start php
brew install mysql
brew services start mysql
brew install nginx
brew services start nginx

macOS使用Homebrew搭建PHP环境

上面命令都是用当前账号启动的 PHP/Nginx/MySQL, 装完 MySQL 后会提示没有设置密码,按照提示的命令执行 mysql_secure_installation 就好。然后 Nginx 是普通用户启动的,默认是 8080 端口,不是 80.

下载WordPress 在本地搭个演示环境。首先在 /usr/local/etc/nginx/servers 新建个 .conf 文件,文件名任意,内容:

server {
    listen 8080; #普通用户没有权限监听 80 所以默认是 8080
    server_name local.blog; #站点域名 需要编辑 hosts 加上
    root /Users/youthlin.chen/www/local.blog/; #站点目录
    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;
    }

    if (!-e $request_filename) {
        rewrite (.*) /index.php; #固定链接
    }

    location ~ /.well-known {
        allow all;
    }

    location ~ /\. {
        deny  all;
    }
}
在Nginx上为WordPress固定链接配置Rewrite

“Mac 常用软件 + PHP 环境”上的5条回复

没用过Mac,不过感觉语句和Linux真的好像

回复 回复时对方会收到邮件通知

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

[/鼓掌] [/难过] [/调皮] [/白眼] [/疑问] [/流泪] [/流汗] [/撇嘴] [/抠鼻] [/惊讶] [/微笑] [/得意] [/大兵] [/坏笑] [/呲牙] [/吓到] [/可爱] [/发怒] [/发呆] [/偷笑] [/亲亲]