DEV Community

kevin
kevin

Posted on

Macbook上LNMP环境配置信息

PHP运行环境为:Nginx + PHP + Mysql + Redis
安装方式:使用homebrew安装

一、Nginx配置信息

1、安装目录:/opt/homebrew/opt/nginx
2、执行文件:/opt/homebrew/opt/nginx
3、配置文件:
主配置文件:/opt/homebrew/etc/nginx/nginx.conf
站点配置文件目录:/opt/homebrew/etc/nginx/services/

4、项目目录:/opt/homebrew/var/www
5、日志目录: /opt/homebrew/var/log/nginx
6、PID : /opt/homebrew/var/run/nginx.pid

操作命令:
brew services start nginx
brew services restart nginx
brew services stop nginx

二、PHP配置信息

1、安装目录:/opt/homebrew/opt/php
2、执行文件:/opt/homebrew/opt/php/bin/php
3、配置文件:/opt/homebrew/etc/php/8.5/php.ini
4、日志文件: /opt/homebrew/var/log/php-fpm.log

操作命令:
brew services start php
brew services restart php
brew services stop php

三、MySql配置信息

1、安装目录: /opt/homebrew/opt/mysql/
2、执行文件:/opt/homebrew/opt/mysql/bin/mysqld
3、配置文件: /etc/my.cnf (自定义)
4、数据存贮目录:/opt/homebred/var/mysql

操作命令:
brew services start mysql
brew services restart mysql
brew services stop mysql

四、Redis配置信息

1、安装目录: /opt/homebrew/opt/redis/
2、执行文件:/opt/homebrew/opt/redis/bin/redis-server
3、配置文件:/opt/homebrew/etc/redis.conf
4、数据存贮目录:/opt/homebrew/var/db/redis

操作命令:
brew services start redis
brew services restart redis
brew services stop redis

Top comments (1)

Collapse
 
topstar_ai profile image
Luis Cruz •

The detailed setup instructions for the LNMP stack on macOS using Homebrew are incredibly valuable, especially the emphasis on the log and configuration file paths. One potential improvement could be to include common troubleshooting tips for each service, as these can save developers time when things don't work as expected. If you're looking for additional engineering support in optimizing the stack or enhancing the setup process, I'd be happy to explore a paid collaboration. What specific challenges have you encountered while configuring these services?