mac下手动安装与配置tengine2.2+php7

本文档详述了在macOS环境下手动安装Tengine2.2和PHP7的步骤,包括更换brew源、源码下载、问题处理、nginx与PHP7的配置、mysql的brew安装、以及各种编译和证书安装等关键环节。在安装过程中,特别提到了针对macOS 10.x的特定问题解决方案,如openssl的64位编译和nginx的错误处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

引言

最近想本地写点程序,要不总是commit代码,效率低…
不喜欢默认安装,那就自己手动安装吧;

说明

  • nginx采用Tengine2.2安装,对应版本为1.8
  • macx10.x报错问题,请耐心安装
  • 尽量使用源码编译安装扩展库
  • zlib,pcre,openssl不需要单独configure,nginx引用过程会自行编译获取对应库文件
  • 本文路径默认为/data/server/
  • 编译后才会有 objs/Makefile 文件

更换brew源

#vim ~/.bashrc //追加如下命令
#export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com

源码下载

问题汇总

  1. macOS 10.x nginx限制处理

报错信息
nginx error: ‘OSAtomicAdd64’ is deprecated: first deprecated in macOS 10.12.
解决办法:
vim objs/Makefile,将:
CFLAGS = -pipe -O -Wall -Wextra -Wpointer-arith -Wno-unused-parameter -Werror -g
这一行去掉-Werror

  1. openssl更改成编译64位

vim objs/Makefile,搜索到如下行:
3.由于macx10+没有ldconfig命令,所以需要更改编译文件,自行添加路径

tengine

安装

#cd /data/install/tengine-2.2.0/
#./configure --prefix=/data/server/nginx --sbin-path=/data/server/nginx/sbin/nginx --conf-path=/data/server/nginx/conf/nginx.conf --error-log-path=/data/server/nginx/log/error.log --http-log-path=/data/server/nginx/log/access.log --pid-path=/data/server/nginx/nginx.pid --lock-path=/data/server/nginx/lock/nginx.lock --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module --with-http_addition_module --with-http_random_index_module --with-http_dav_module --with-openssl=/data/server/src/openssl-1.0.2l --with-pcre=/data/server/src/pcre-8.38 --with-zlib=/data/server/src/zlib-1.2.11
#vim objs/Makefile
#第二行,去掉-Werror
#搜索openssl,将./config --prefix=/data/server/src/openssl-1.0.2l/.openssl no-shared
更换位:./Configure darwin64-x86_64-cc  --prefix=/data/server/src/openssl-1.0.2l/.openssl no-shared
#make test
#make
#make install
#/data/server/nginx/sbin/nginx -m

配置

https
证书安装
#mkdir /data/server/nginx/ssl
#cd /data/server/nginx/ssl
/**根据提示输入密码和组织信息即可**/
#/usr/local/openssl/bin/openssl genrsa -des3 -out server.key 1024
#/usr/local/openssl/bin/openssl req -new -key server.key -out server.csr
#/usr/local/openssl/bin/openssl rsa -in server.key -out server_nopwd.key
#/usr/local/openssl/bin/openssl x509 -req -days 365 -in server.csr -signkey server_nopwd.key -out server.crt
配置nginx
/**建立80端口所有域名转发**/
#vim vhost_default.conf
#vim vhost_default.conf //参看附件1</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值