macos mojave 10.14.3 配置nginx+mysql+php

本文详细介绍了在Mac mojave 10.14.3系统中,如何使用Homebrew安装并配置Nginx、PHP及MySQL,实现一个完整的LAMP环境。包括安装步骤、配置文件修改及服务管理命令,适合初学者快速搭建本地开发环境。
Mac 配置Nginx + php + mysql

系统 mojave  10.14.3

1,安装homebrew

      中文官网地址  https://brew.sh/index_zh-cn.html

      安装命令 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2,安装nginx
      brew install nginx
3,启动nginx

      sudo nginx

4,重启 nginx
      sudo nginx -s reload

5,cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf
     并 修改 php-fpm.conf文件 error_log 配置为 /usr/local/var/log/php-fpm.log,
6 , 更改    cp www.conf.default www.conf

7 ,开启 php-fpm: sudo php-fpm -D

//配置文件

server {
    listen 80;
    server_name  www.hello.com;
    root   /Users/koloor/wwwroot/hello;
    location / {
        index  index.html index.htm index.php;
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}







#测试配置是否有语法错误

 nginx -t



 #打开 nginx

 sudo nginx



 #重新加载配置|重启|停止|退出 nginx

 nginx -s reload|reopen|stop|quit





brew 安装 Mysql



brew info mysql 检查依赖



brew install mysql 安装mysql 默认是最新版本





We've installed your MySQL database without a root password. To secure it run:

    mysql_secure_installation



MySQL is configured to only allow connections from localhost by default



To connect run:

    mysql -uroot



To have launchd start mysql now and restart at login:

  brew services start mysql

Or, if you don't want/need a background service you can just run:

  启动mysql   mysql.server start



安装完成 初始化设置 :  mysql_secure_installation



#启动

brew services start mysql

#重启

brew services restart mysql

#停止

brew services stop mysql

#查看所有可由Homebrew管理的服务

brew services list

 

转载于:https://my.oschina.net/koloor/blog/3006545

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值