homebrew install nginx mysql php

/ 0评 / 0

安装 brew install mysql

启动 mysql.server start

安装 brew install php

启动 brew services start php

安装 brew install nginx

启动 nginx

设置nginx配置文件

server {
        listen 80;
        root /Users/wang/Code/test;  #项目文件地址
        index index.php index.html index.htm;
        server_name test.test; #本地域名,可以在host里定义   
        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
        location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
        location ~ /\.ht {
                deny all;
        }
}

安装 composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php composer-setup.php --install-dir=/usr/local/bin --filename=composer

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/