mac 配置 httpd nginx php-fpm 详细记录 已解决
在日常mac电脑 开发php项目一直是 httpd 方式 运行,由于有 多版本 运行的需求,docker不想用,索性用 php-fpm进行 功能处理。上次配置 是好的,但是感觉马马虎虎,这次 配置底朝天。因为配置服务器,几乎也都是傻瓜命令, 很少注意细节,大致出现问题原因,用户和组的问题。



运行代码 有 unknown 字样。错误 是 运行用户权限 有误

参考链接
https://blog.csdn.net/qq_23306647/article/details/107442078/
https://blog.51cto.com/u_15230485/5821339 // mac 用户组的概念



nginx 详细 使用 流程
nginx.conf 代码
#user nobody;user zhenxi admin;
worker_processes 1;#error_log 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;# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}include servers/*;include vhosts/*;
}
虚拟主机 fast.demo.com.conf 代码
server {#监听端口listen 80;#虚拟主机域名server_name fast.demo.com;#网站根目录root /Users/zhenxi/www/fast.demo.com/public;access_log /usr/local/var/log/fast_demo_com.access.error_log;error_log /usr/local/var/log/fast_demo_com.error.log error;#定义路径下默认访问的文件名index index.php index.html;location / {#try_files $uri $uri/ /index.php?$query_string;#打开目录浏览功能,可以列出整个目录#autoindex on;index index.php index.html index.htm;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000location ~ \.php$ {#try_files $uri = 404;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}location ~ .*\.(bmp|gif|jpg|jpeg|png|swf)$ {access_log off;expires 30d;}
}
日常命令
sudo nginx -c /usr/local/etc/nginx/nginx.confps aux | grep nginx. 查看启动 用户权限sudo nginx -t 测试修改是否成功sudo nginx 启动sudo nginx -s reload 重启sudo brew services start nginx -d 集成命令sudo lsof -Pni4| grep nginx // 管道 查找进程sudo kill -9
php-fpm 详细使用流程
php-fpm.conf 代码
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;; All relative paths in this configuration file are relative to PHP's install
; prefix (/usr/local/Cellar/php@7.4/7.4.23). This prefix can be dynamically changed by using the
; '-p' argument from the command line.;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;[global]
; Pid file
; Note: the default prefix is /usr/local/var
; Default Value: none
pid = run/php-fpm.pid; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; into a local file.
; Note: the default prefix is /usr/local/var
; Default Value: log/php-fpm.log
error_log = log/php-fpm.log; syslog_facility is used to specify what type of program is logging the
; message. This lets syslogd specify that messages from different facilities
; will be handled differently.
; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
; Default Value: daemon
;syslog.facility = daemon; syslog_ident is prepended to every message. If you have multiple FPM
; instances running on the same server, you can change the default value
; which must suit common needs.
; Default Value: php-fpm
;syslog.ident = php-fpm; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice; Log limit on number of characters in the single line (log entry). If the
; line is over the limit, it is wrapped on multiple lines. The limit is for
; all logged characters including message prefix and suffix if present. However
; the new line character does not count into it as it is present only when
; logging to a file descriptor. It means the new line character is not present
; when logging to syslog.
; Default Value: 1024
;log_limit = 4096; Log buffering specifies if the log line is buffered which means that the
; line is written in a single write operation. If the value is false, then the
; data is written directly into the file descriptor. It is an experimental
; option that can potentionaly improve logging performance and memory usage
; for some heavy logging scenarios. This option is ignored if logging to syslog
; as it has to be always buffered.
; Default value: yes
;log_buffering = no; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0; The maximum number of processes FPM will fork. This has been designed to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
; process.max = 128; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lowest priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool process will inherit the master process priority
; unless specified otherwise
; Default Value: no set
; process.priority = -19; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = no; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0; Specify the event mechanism FPM will use. The following is available:
; - select (any POSIX os)
; - poll (any POSIX os)
; - epoll (linux >= 2.5.44)
; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
; - /dev/poll (Solaris >= 7)
; - port (Solaris >= 10)
; Default Value: not set (auto detection)
;events.mechanism = epoll; When FPM is built with systemd integration, specify the interval,
; in seconds, between health report notification to systemd.
; Set to 0 to disable.
; Available Units: s(econds), m(inutes), h(ours)
; Default Unit: seconds
; Default value: 10
;systemd_interval = 10;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;; Multiple pools of child processes may be started with different listening
; ports and different management options. The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :); Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
; Relative path can also be used. They will be prefixed by:
; - the global prefix if it's been set (-p argument)
; - /usr/local/Cellar/php@7.4/7.4.23 otherwise
include=/usr/local/etc/php/7.4/php-fpm.d/*.conf
www.conf 代码
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr/local/Cellar/php@7.4/7.4.23) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = zhenxi
group = admin
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
运行情况 分别是 9080 代表 php8.0 fpm 9074 代表 php7.4版本

php-fpm 详细 运行代码
启动 php-fpmphp-fpm -c /usr/local/etc/php/7.4/php.ini -y /usr/local/etc/php/7.4/php-fpm.conflaunchctl list | grep php 查看 9100是否启动sudo lsof -i :9000 Mac 查看端口占用方法sudo lsof -Pni4 | grep LISTEN | grep php 查看 php进程号sudo kill -9 <进程ID> 关闭进程sudo brew services start php@7.4 -d 集成命令
httpd 日常命令
Listen 80LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so
#LoadModule php_module /usr/local/opt/php@8.0/lib/httpd/modules/libphp.so<FilesMatch \.php$>SetHandler application/x-httpd-php
</FilesMatch><Directory />AllowOverride noneRequire all denied
</Directory>DocumentRoot "/Users/zhenxi/www"
<Directory "/Users/zhenxi/www">## Possible values for the Options directive are "None", "All",# or any combination of:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews## Note that "MultiViews" must be named *explicitly* --- "Options All"# doesn't give it to you.## The Options directive is both complicated and important. Please see# http://httpd.apache.org/docs/2.4/mod/core.html#options# for more information.#Options FollowSymLinks Multiviews Indexes ## AllowOverride controls what directives may be placed in .htaccess files.# It can be "All", "None", or any combination of the keywords:# AllowOverride FileInfo AuthConfig Limit#AllowOverride All## Controls who can get stuff from this server.#Require all granted
</Directory><IfModule dir_module>DirectoryIndex index.php index.html
</IfModule># Virtual hosts
Include /usr/local/etc/httpd/extra/httpd-vhosts.conf
httpd 虚拟主机代码
<VirtualHost *:80>DocumentRoot "/Users/zhenxi/www/fast.demo.com/public"ErrorLog "/Users/zhenxi/www/fast.demo.com/error_log"ServerName fast.demo.com
</VirtualHost>
httpd 日常命令
brew services start httpd 聚合命令sudo httpd 启动sudo lsof -Pni4 | grep LISTEN | grep httpd 查看httpd 进程sudo kill -9 <进程ID> 关闭进程
日志查看命令
tail -f -n 100 2021.log
相关文章:
mac 配置 httpd nginx php-fpm 详细记录 已解决
在日常mac电脑 开发php项目一直是 httpd 方式 运行,由于有 多版本 运行的需求,docker不想用,索性用 php-fpm进行 功能处理。上次配置 是好的,但是感觉马马虎虎,这次 配置底朝天。因为配置服务器,几乎也都是…...
Angular 项目升级需要注意什么?
升级Angular项目是一个重要的任务,因为它可以帮助你获得新的功能、性能改进和安全性增强。然而,Angular的版本升级可能会涉及到一些潜在的问题和挑战。以下是升级Angular项目时需要注意的一些重要事项: 备份项目:在升级之前&…...
开发高性能知识付费平台:关键技术策略
引言 在构建知识付费平台时,高性能是确保用户满意度和平台成功的关键因素之一。本文将探讨一些关键的技术策略,帮助开发者打造高性能的知识付费平台。 1. 前端性能优化 使用CDN加速资源加载 使用内容分发网络(CDN)来托管和加…...
python图像匹配:如何使用Python进行图像匹配
Python图像匹配是指使用Python编写的程序来进行图像匹配。它可以在两幅图像之间找到相似的部分,从而实现图像检索、图像比较、图像拼接等功能。 Python图像匹配是指使用Python编写的程序来进行图像匹配。它可以在两幅图像之间找到相似的部分,从而实现图…...
R语言绘制PCA双标图、碎石图、变量载荷图和变量贡献图
1、原论文数据双标图 代码: setwd("D:/Desktop/0000/R") #更改路径#导入数据 df <- read.table("Input data.csv", header T, sep ",")# ----------------------------------- #所需的包: packages <- c("ggplot2&quo…...
Jolokia 笔记 (Kafka/start/stop)
目录 1. Jolokia 笔记 (Kafka/start/stop) 1. Jolokia 笔记 (Kafka/start/stop) java -javaagent:agent.jarport8778,hostlocalhostJolokia 是作为 Kafka 的 Java agent, 基于 HTTP 协议提供了一个使用 JSON 作为数据格式的外部接口, 提供给 DataKit 使用。 Kafka 启动时, 先配…...
Qt5开发及实例V2.0-第十九章-Qt.QML编程基础
Qt5开发及实例V2.0-第十九章-Qt.QML编程基础 第19章 QML编程基础19.1 QML概述19.1.1 第一个QML程序19.1.2 QML文档构成19.1.3 QML基本语法 19.2 QML可视元素19.2.1 Rectangle(矩形)元素19.2.2 Image(图像)元素19.2.3 Text…...
固定开发板的ifconfig的IP地址
背景 由于我是使用vsocode的ssh插件远程连接我的开发板, 所以我每次开机就要重新连上屏幕看一下这个ifconfig的ip地址然后更改我的ssh config文件 这里提供一个使用nmcli设置静态IP的方法 请确保使用你的实际连接名称替换Wi-Fi connection 1 使用nmcli设置静态IP相对直接&a…...
停车场系统源码
源码下载地址(小程序开源地址):停车场系统小程序,新能源电动车充电系统,智慧社区物业人脸门禁小程序: 【涵盖内容】:城市智慧停车系统,汽车新能源充电,两轮电动车充电,物…...
R语言贝叶斯MCMC:GLM逻辑回归、Rstan线性回归、Metropolis Hastings与Gibbs采样算法实例...
原文链接:http://tecdat.cn/?p23236 在频率学派中,观察样本是随机的,而参数是固定的、未知的数量(点击文末“阅读原文”获取完整代码数据)。 相关视频 什么是频率学派? 概率被解释为一个随机过程的许多观测…...
若依前后端分离如何解决匿名注解启动报错?
SpringBoot2.6.0默认是ant_path_matcher解析方式,但是2.6.0之后默认是path_pattern_parser解析方式。 所以导致读取注解类方法需要对应的调整,当前若依项目默认版本是2.5.x,如果使用大于2.6.x,需要将info.getPatternsCondition().getPatterns()修改为info.getPathPatterns…...
Spring面试题4:面试官:说一说Spring由哪些模块组成?说一说JDBC和DAO之间的联系和区别?
该文章专注于面试,面试只要回答关键点即可,不需要对框架有非常深入的回答,如果你想应付面试,是足够了,抓住关键点 面试官:说一说Spring由哪些模块组成? Spring是一个开源的Java框架,由多个模块组成,每个模块都提供不同的功能和特性。下面是Spring框架的主要模块: S…...
【再识C进阶3(上)】详细地认识字符串函数、进行模拟字符串函数以及拓展内容
小编在写这篇博客时,经过了九一八,回想起了祖国曾经的伤疤,勿忘国耻,振兴中华!加油,逐梦少年! 前言 💓作者简介: 加油,旭杏,目前大二,…...
docker启动mysql8目录挂载改动
5.7版本: 拉取mysql镜像 docker pull mysql:5.7启动 docker run -p 3306:3306 --name mysql5 \ -v /Users/zhaosichun/data/dockerData/log:/var/log/mysql \ -v /Users/zhaosichun/data/dockerData/data:/var/lib/mysql \ -v /Users/zhaosichun/data/dockerData…...
CHATGPT中国免费网页版有哪些-CHATGPT中文版网页
CHATGPT中国免费网页版,一个强大的人工智能聊天机器人。如果你曾经感到困惑、寻求答案,或者需要一些灵感,那么CHATGPT国内网页版可能会成为你的好朋友。 CHATGPT国内免费网页版:你的多面“好朋友” 随着人工智能技术的不断发展&a…...
docker network create命令
docker network create命令用于创建一个新的网络连接。 DRIVER接受内置网络驱动程序的桥接或覆盖。如果安装了第三方或自己的自定义网络驱动程序,则可以在此处指定DRIVER。 如果不指定--driver选项,该命令将为您自动创建一个桥接网络。 当安装Docker Eng…...
4G版本云音响设置教程腾讯云平台版本
文章目录 4G本云音响设置教程介绍一、申请设备三元素1.腾讯云物联网平台2.创建产品3.设置产品参数4.添加设备5.获取三元素 二、设置设备三元素1.打开MQTTConfigTools2.计算MQTT参数3.使用USB连接设备4.设置参数 三、腾讯云物联网套件协议使用说明1.推送协议信息2.topic规则说明…...
Grafana离线安装部署以及插件安装
Grafana是一个可视化面板(Dashboard),有着非常漂亮的图表和布局展示,功能齐全的度量仪表盘和图形编辑器,支持Graphite、zabbix、InfluxDB、Prometheus和OpenTSDB作为数据源。Grafana主要特性:灵活丰富的图形…...
非独立随机变量的概率上界估计
目前的概率论或者随机变量书籍过分强调对独立随机变量的大数定律,中心极限定理,遗憾上界的估计。而对于非独立随机变量的研究很少,在《概率论的极限定理》中曾给出过一般随机变量求和的渐进分布簇的具体形式,然而形式却太过复杂。…...
常见电子仪器及其用途
常见电子仪器及其用途包括: 示波器:示波器是一种用途十分广泛、易于使用且功能强大的电子测量仪器。它能把肉眼看不见的电信号变换成看得见的图像,便于我们研究各种电现象的变化过程。示波器可以直接用来测量电信号的波形,是电子…...
Halcon三维点云实战:从鞋点胶到工业检测的完整流程解析
Halcon三维点云实战:从鞋点胶到工业检测的完整流程解析 在精密制造领域,视觉检测正经历着从二维到三维的深刻变革。过去,工程师们依赖二维图像分析轮廓、对比灰度,但面对复杂曲面、装配间隙、微小形变等三维空间问题,传…...
零代码数据可视化:用Cursor与MCP Server Chart快速构建Netlify在线看板
1. 从晨会焦虑到分钟级响应:一个真实运营场景的破局 周一早上九点半,运营小张的电脑屏幕还停留在昨晚导出的那份密密麻麻的Excel表格上。数据是上周的用户行为日志,老板在十分钟后的晨会上,需要他快速讲清楚几个关键问题ÿ…...
Windows下Sourcetree安装与基础Git操作指南(适合SVN转Git的新手)
从SVN到Git的平滑过渡:Sourcetree可视化实战指南 如果你和我一样,职业生涯的前半段是在SVN的“集中式”世界里度过的,那么初次接触Git时,那种面对命令行和分布式概念的茫然感,我深有体会。在SVN里,一切井然…...
提示词管理工具推荐prompt-manage,Docker一键部署和使用指南
prompt-manage 是一款面向 AI 从业者的轻量级开源提示词管理工具,专为 Docker 私有化部署设计,无外部依赖、开箱即用;提供提示词增删改查、标签分类、全文检索、版本控制、一键复制与数据导入导出,支持本地私密存储与网页端管理&a…...
Oh My Zsh 使用指南:Zsh 终端配置与插件管理教程
carbon在 Linux 或 macOS 系统中,终端是开发者和运维人员每天都会使用的重要工具。 默认的 Bash 终端虽然功能完整,但在使用体验和效率方面还有很大的提升空间。 例如: 命令自动补全 终端主题美化 插件扩展 Git 快捷命令 因此很多开发者会…...
如何用postgresql-hll实现滑动窗口去重?电商平台7天活跃用户统计案例
如何用postgresql-hll实现滑动窗口去重?电商平台7天活跃用户统计案例 【免费下载链接】postgresql-hll PostgreSQL extension adding HyperLogLog data structures as a native data type 项目地址: https://gitcode.com/gh_mirrors/pos/postgresql-hll 在大…...
Learnhouse SCORM集成教程:打造交互式学习体验
Learnhouse SCORM集成教程:打造交互式学习体验 【免费下载链接】learnhouse The Next-Gen Open Source learning platform ✨ 项目地址: https://gitcode.com/gh_mirrors/le/learnhouse Learnhouse作为下一代开源学习平台,提供了强大的SCORM集成功…...
【Python】 -- 趣味代码 - 小恐龙游戏
文章目录 文章目录 00 小恐龙游戏程序设计框架代码结构和功能游戏流程总结01 小恐龙游戏程序设计02 百度网盘地址00 小恐龙游戏程序设计框架 这段代码是一个基于 Pygame 的简易跑酷游戏的完整实现,玩家控制一个角色(龙)躲避障碍物(仙人掌和乌鸦)。以下是代码的详细介绍:…...
STM32标准库-DMA直接存储器存取
文章目录 一、DMA1.1简介1.2存储器映像1.3DMA框图1.4DMA基本结构1.5DMA请求1.6数据宽度与对齐1.7数据转运DMA1.8ADC扫描模式DMA 二、数据转运DMA2.1接线图2.2代码2.3相关API 一、DMA 1.1简介 DMA(Direct Memory Access)直接存储器存取 DMA可以提供外设…...
ESP32 I2S音频总线学习笔记(四): INMP441采集音频并实时播放
简介 前面两期文章我们介绍了I2S的读取和写入,一个是通过INMP441麦克风模块采集音频,一个是通过PCM5102A模块播放音频,那如果我们将两者结合起来,将麦克风采集到的音频通过PCM5102A播放,是不是就可以做一个扩音器了呢…...
