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 等待:

1
2
3
4
5
6
7
8
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   <code>source ~/.profile</code>)
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 文件,文件名任意,内容:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

Reader Echoes

5 comments

  • #1540Youth.霖
    iTerm Home/End 行首行尾按键 Key 绑定: ^[ = Send Escape Sequence Home:^[ + [1~ End: ^[ + [4~ ~/.zshrc <pre> bindkey "^[[1~" beginning-of-line bindkey "^[[4~" end-of-line </pre> //see https://www.nesono.com/node/351
  • #1539Youth.霖
    鼠标滚动方向反向 https://pilotmoon.com/scrollreverser/
  • #1538C
    没用过Mac,不过感觉语句和Linux真的好像
  • #1536小菜
    新年快乐更新了啊,我好久没更新了
    • #1537Youth.霖
      回复 @小菜哈哈,新年快乐,我也发现了,我可是会偶尔转转你的博客呢

表情

评论提交后需经审核才会显示。