mac m2芯片 安装nginx + php + mysql
1.安装homebrew:
系统本身就有(命令brew -v查看下),如果没有安装一下
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
2.安装nginx
brew install nginx
3.安装php
brew tap shivammathur/php
brew search php
brew install shivammathur/php/php@7.4
如果安装多个php版本,就修改下PHP端口配置:
我的路径是:/opt/homebrew/etc/php/7.4/php-fpm.d/www.conf
listen = 127.0.0.1:9000
改为
listen = 127.0.0.1:9074
4.修改nginx配置
sudo vim /opt/homebrew/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;error_log /var/logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;#log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#access_log logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;include servers/*;
}
5.在 /opt/homebrew/etc/nginx下新建文件夹servers,在servers下新建新建test1.conf和test2.conf
mkdir servers
cd servers
vim test1.conf
test1.conf配置内容
server {listen 80;server_name www.test1.cn;# 配置项目路径root /Users/liuxiaoyun/www/test1; #access_log logs/host.access.log main;location / {index index.html index.htm index.php;if (!-e $request_filename) {rewrite ^(.*)$ /index.php?s=/$1 last;break;}}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000location ~ \.php$ {# 9074上面设置的监听端口,加载php7.4fastcgi_pass 127.0.0.1:9074;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
}
test2.conf的配置
server {listen 80;server_name www.test2.cn;# 配置项目路径root /Users/liuxiaoyun/www/test2; #access_log logs/host.access.log main;location / {index index.html index.htm index.php;if (!-e $request_filename) {rewrite ^(.*)$ /index.php?s=/$1 last;break;}}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000location ~ \.php$ {# 9074上面设置的监听端口,加载php7.4fastcgi_pass 127.0.0.1:9074;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
}
6.检查配置
nginx -t
如果报文件权限问题:sudo chmod -R 777 /var/logs
7.设置php-fpm开机自启
sudo cp /opt/homebrew/opt/php@7.4/homebrew.php@7.4.service /Library/LaunchAgents
8.启动php-fpm
brew services start php@7.4
9.验证是否启动成功
lsof -i :9074
10.终端切换php版本
解除之前版本链接:brew unlink php
增加新版本链接:
brew link --overwrite php@7.4
11.php加入环境变量
echo 'export PATH="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
12.安装composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer74
13.验证composer
composer74 -v
14.mysql加入环境变量
echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrcFor compilers to find mysql@5.7 you may need to set:export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"
15.启动数据库
brew services start mysql@5.7
16.brew安装mysql5.7总是出问题,我的解决办法是,更新homebrew,安装的mysql8.0
17.php项目运行:
(1).nginx执行重新加载:nginx -s reload ;报错:
[error] invalid PID number "" in "/opt/homebrew/var/run/nginx.pid"
解决:
重新加载配置文件 nginx.conf,然后再执行 reload:nginx -c /opt/homebrew/etc/nginx/nginx.conf
nginx -s reload
(2). 修改hosts文件,/etc/hosts。添加自定义本地域名
#上边配置的test1.conf和test2.conf文件里自定义的域名
127.0.0.1。www.test1.cn
127.0.0.1。www.test2.cn
(3).在~/www/test1里添加index.php。访问域名www.test1.cn就完成啦
相关文章:
mac m2芯片 安装nginx + php + mysql
1.安装homebrew: 系统本身就有(命令brew -v查看下),如果没有安装一下 /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 2.安装nginx brew install nginx 3.安装php bre…...
vue axios 使用
使用Vue中的Axios需要先安装axios库,可以通过yarn或npm安装: yarn add axios # 或者 npm install axios --save然后在Vue组件中导入axios并使用: import axios from axios;export default {data() {return {responseData: null,error: null…...
使用docker实现logstash同步mysql到es
准备工作: 1.有mysql的连接方式,并且可以连接成功 2.有es的连接方式,并且可以连接成功 3.安装了docker 环境是Ubuntu中安装了docker 一、创建配置文件,用于容器卷挂载 # 切换目录,可自定义 cd /home/test/ # 创建lo…...
hive数据仓库工具
1、hive是一套操作数据仓库的应用工具,通过这个工具可实现mapreduce的功能 2、hive的语言是hql[hive query language] 3、官网hive.apache.org 下载hive软件包地址 Welcome! - The Apache Software Foundationhttps://archive.apache.org/ 4、hive在管理数据时分为元…...
C语言 联合体验证 主机字节序 +枚举
联合体应用:验证当前主机的大小端(字节序) //验证当前主机的大小端 #include <stdio.h>union MyData {unsigned int data;struct{unsigned char byte0;unsigned char byte1;unsigned char byte2;unsigned char byte3;}byte; };int main…...
python和pygame实现烟花特效
python和pygame实现烟花特效 新年来临之际,来一个欢庆新年烟花祝贺,需要安装使用第三方库pygame,关于Python中pygame游戏模块的安装使用可见 https://blog.csdn.net/cnds123/article/details/119514520 效果图及源码 先看效果图:…...
gRPC-Gateway:高效转换 RESTful 接口 | 开源日报 No.105
grpc-ecosystem/grpc-gateway Stars: 16.4k License: BSD-3-Clause gRPC-Gateway 是一个遵循 gRPC HTTP 规范的 gRPC 到 JSON 代理生成器。它是 Google 协议缓冲编译器 protoc 的插件,可以读取 protobuf 服务定义并生成反向代理服务器,将 RESTful HTTP…...
非专业的建模人员如何给模型设置材质纹理贴图?
在线工具推荐: 3D数字孪生场景编辑器 - GLTF/GLB材质纹理编辑器 - 3D模型在线转换 - Three.js AI自动纹理开发包 - YOLO 虚幻合成数据生成器 - 三维模型预览图生成器 - 3D模型语义搜索引擎 1、材质和纹理的区别于关联 材质(Material)是…...
自动化测试、压力测试、持续集成
因为项目的原因,前段时间研究并使用了 SoapUI 测试工具进行自测开发的 api。下面将研究的成果展示给大家,希望对需要的人有所帮助。 SoapUI 是什么? SoapUI 是一个开源测试工具,通过 soap/http 来检查、调用、实现 Web Service …...
FFmpeg之HWContextType
HWContextType算是ffmpeg中为硬解码第三方接口的一个辅助类,它自己有两个辅助子类 AVHWDeviceContext和AVHWFramesContext。 AVHWDeviceContext主要表示硬件上下文 AVHWFramesContext主要表示硬件Frame的一些参数,比如你解码后的YUV数据还在硬件上&#…...
Python面向对象之类和对象(Python系列16)
前言:面向对象是什么,为什么要学面向对象?面向对象是一种思想,让我们的程序变得更加的贴切我们的生活,更加的形象,让代码的可读性和扩展性变得更高。 面向对象:可以使用类将变量和函数组成新的…...
电商对传统零售业的影响:销售渠道、价格竞争与服务质量挑战
随着互联网的普及和电商行业的飞速发展,传统零售业面临着前所未有的挑战。电商不仅改变了消费者的购物方式和消费习惯,还对传统零售业的销售渠道、价格竞争和服务质量等方面产生了深远的影响。本文将详细分析电商对传统零售业的影响,以期为传…...
DENet:用于可见水印去除的Disentangled Embedding网络笔记
1 Title DENet: Disentangled Embedding Network for Visible Watermark Removal(Ruizhou Sun、Yukun Su、Qingyao Wu)[AAAI2023 Oral] 2 Conclusion This paper propose a novel contrastive learning mechanism to disentangle the high-level embedd…...
C++初阶(十五)Stack和Queue
文章目录 一、Stack的模拟实现二、Queue的模拟实现三、容器适配器1、什么是容器适配器2、STL标准库中stack和queue的底层结构3、 deque的简单介绍(了解)1、deque的原理介绍2、deque的缺陷 4、为什么选择deque作为stack和queue的底层默认容器 一、Stack的模拟实现 #include<…...
C#面试题
基本概念 装箱和拆箱 装箱的过程,是将 值类型 转换为 引用类型 的过程; 拆箱则是将引用类型转换为值类型。 int val 100; object obj val; //装箱 int num (int) obj; //拆箱 委托(delegate) 委托(Delegate) 是存有对某个…...
python源码,在线读取传奇列表,并解析为需要的JSON格式
python源码,在线读取传奇列表,并解析为需要的JSON格式 [Server] ; 使用“/”字符分开颜色,也可以不使用颜色,支持以前的旧格式,只有标题和服务器标题支持颜色 ; 标题/颜色代码(0-255)|服务器标题/颜色代码(0-255)|服务…...
二叉排序树的判断(二叉树的顺序存储):2022年408算法题
对于采用顺序存储方式保存的二叉树,根结点保存在SqBiTNode[0]中;当某结点保存SqBiTNode[i]中时,若有左孩子,则其值保存在SqBiTNode [2i1]中;若有右孩子,则其值保存在SqBiTNode[2i2]中;若有双亲结…...
Kubernetes版本升级到v1.18.0方法
升级k8s版本才能使用kube-prometheus安装监控 1、查看集群状态 [rootk8s-master k8s-script]# kubectl get nodes NAME STATUS ROLES AGE VERSION k8s-master Ready master 5d22h v1.18.0 k8s-slave1 Ready <none> 4d10h v1.18.0 k…...
了解 git rebase
了解 git rebase 大多数人习惯使用 git merge 将更改从功能分支合并到主分支,但还有其他方法。我们是否曾经遇到过 git rebase 这个术语并想知道它是什么?或者我们可能听说过 rebase 和 merge ,但不确定何时使用哪个?不用担心&am…...
程序员的养生之道:延寿健康的十大秘诀(下)
程序员的养生之道:延寿健康的十大秘诀(上)-CSDN博客 目录 6. 心理调节,减轻压力 6.1 程序员常见的心理问题 6.2 压力管理的重要性 6.3 放松技巧与应对策略 6.4 积极心态与心理健康 7. 正确坐姿,保护颈椎腰椎 …...
Vue记事本应用实现教程
文章目录 1. 项目介绍2. 开发环境准备3. 设计应用界面4. 创建Vue实例和数据模型5. 实现记事本功能5.1 添加新记事项5.2 删除记事项5.3 清空所有记事 6. 添加样式7. 功能扩展:显示创建时间8. 功能扩展:记事项搜索9. 完整代码10. Vue知识点解析10.1 数据绑…...
java_网络服务相关_gateway_nacos_feign区别联系
1. spring-cloud-starter-gateway 作用:作为微服务架构的网关,统一入口,处理所有外部请求。 核心能力: 路由转发(基于路径、服务名等)过滤器(鉴权、限流、日志、Header 处理)支持负…...
【Linux】C语言执行shell指令
在C语言中执行Shell指令 在C语言中,有几种方法可以执行Shell指令: 1. 使用system()函数 这是最简单的方法,包含在stdlib.h头文件中: #include <stdlib.h>int main() {system("ls -l"); // 执行ls -l命令retu…...
mongodb源码分析session执行handleRequest命令find过程
mongo/transport/service_state_machine.cpp已经分析startSession创建ASIOSession过程,并且验证connection是否超过限制ASIOSession和connection是循环接受客户端命令,把数据流转换成Message,状态转变流程是:State::Created 》 St…...
SCAU期末笔记 - 数据分析与数据挖掘题库解析
这门怎么题库答案不全啊日 来简单学一下子来 一、选择题(可多选) 将原始数据进行集成、变换、维度规约、数值规约是在以下哪个步骤的任务?(C) A. 频繁模式挖掘 B.分类和预测 C.数据预处理 D.数据流挖掘 A. 频繁模式挖掘:专注于发现数据中…...
Python爬虫实战:研究feedparser库相关技术
1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的信息资源。RSS(Really Simple Syndication)作为一种标准化的信息聚合技术,被广泛用于网站内容的发布和订阅。通过 RSS,用户可以方便地获取网站更新的内容,而无需频繁访问各个网站。 然而,互联网…...
ESP32读取DHT11温湿度数据
芯片:ESP32 环境:Arduino 一、安装DHT11传感器库 红框的库,别安装错了 二、代码 注意,DATA口要连接在D15上 #include "DHT.h" // 包含DHT库#define DHTPIN 15 // 定义DHT11数据引脚连接到ESP32的GPIO15 #define D…...
P3 QT项目----记事本(3.8)
3.8 记事本项目总结 项目源码 1.main.cpp #include "widget.h" #include <QApplication> int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); } 2.widget.cpp #include "widget.h" #include &q…...
css的定位(position)详解:相对定位 绝对定位 固定定位
在 CSS 中,元素的定位通过 position 属性控制,共有 5 种定位模式:static(静态定位)、relative(相对定位)、absolute(绝对定位)、fixed(固定定位)和…...
高防服务器能够抵御哪些网络攻击呢?
高防服务器作为一种有着高度防御能力的服务器,可以帮助网站应对分布式拒绝服务攻击,有效识别和清理一些恶意的网络流量,为用户提供安全且稳定的网络环境,那么,高防服务器一般都可以抵御哪些网络攻击呢?下面…...
