当前位置: 首页 > news >正文

MacPorts 安装 Tengine

创建 Portfile

以下是我参考 nginx 调整后的 Portfile,如需安装指定版本,除了修改版本号之外还需要修改 checksums 里的 sha256

sha256 值需下载 Tengine 源码文件(tar.gz)进行计算

模块的调整在最后的 configure.args-append 部分,参考 https://tengine.taobao.org/document/install.html 和 Nginx 编译参数

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4PortSystem          1.0name                tengine
version             3.1.0
revision            0
categories          www
license             BSD
maintainers         nomaintainerconflicts           nginx nginx-develdescription         A high performance web server based on Nginx
long_description    Tengine is a web server originated by Taobao, \compatible with Nginx, with additional features.homepage            http://tengine.taobao.org
master_sites        http://tengine.taobao.org/downloaddistname            ${name}-${version}
checksums           sha256 64ed7155c0c904ce0fe7199c21b8eb6c2abfc267278fa8af832c0cb781e864dcdepends_lib         port:pcre \port:openssl \port:zlibset nginx_share     ${prefix}/share/${name}
set nginx_examples  ${nginx_share}/examples
set nginx_confdir   ${prefix}/etc/${name}
set nginx_logdir    ${prefix}/var/log/${name}
set nginx_rundir    ${prefix}/var/run/${name}
set nginx_pidfile   ${nginx_rundir}/${name}.pid
set nginx_all_confs {fastcgi.conf fastcgi_params mime.types nginx.conf scgi_params uwsgi_params}
set auto_activate_confs {nginx.conf mime.types fastcgi.conf}configure.args-append \--with-cc-opt=\"${configure.cppflags} ${configure.cflags}\" \--with-ld-opt=\"${configure.ldflags}\" \--conf-path=${nginx_confdir}/nginx.conf \--error-log-path=${nginx_logdir}/error.log \--http-log-path=${nginx_logdir}/access.log \--pid-path=${nginx_pidfile} \--lock-path=${nginx_rundir}/${name}.lock \--http-client-body-temp-path=${nginx_rundir}/client_body_temp \--http-proxy-temp-path=${nginx_rundir}/proxy_temp \--http-fastcgi-temp-path=${nginx_rundir}/fastcgi_temp \--http-uwsgi-temp-path=${nginx_rundir}/uwsgi_temp \--http-scgi-temp-path=${nginx_rundir}/scgi_temp \--with-compat# pcre2 breaks the lua module (https://trac.macports.org/ticket/65150)
configure.args-append             --without-pcre2# remove --disable-dependency-tracking
configure.universal_args-delete   --disable-dependency-trackingbuild.target        build
destroot.keepdirs   ${destroot}${nginx_logdir} \${destroot}${nginx_rundir}post-destroot {xinstall -d -m 755 ${destroot}${nginx_share}xinstall -d -m 755 ${destroot}${nginx_examples}foreach conf ${nginx_all_confs} {set conf_path "${destroot}${nginx_confdir}/${conf}"if {[file exists ${conf_path}]} {file delete ${conf_path}}if {[file exists ${conf_path}.default]} {move ${conf_path}.default ${destroot}${nginx_examples}}}file rename ${destroot}${prefix}/html ${destroot}${nginx_share}# Install the manpageset man_path "${destroot}${prefix}/share/man/man8"xinstall -d -m 0755 ${man_path}xinstall    -m 0644 ${worksrcpath}/man/nginx.8 ${man_path}reinplace -q "s|/var/run/mytengine.pid|${nginx_pidfile}/|g" ${man_path}/nginx.8
}post-activate {foreach conf ${auto_activate_confs} {if {![file exists ${nginx_confdir}/${conf}]} {xinstall -m 644 ${nginx_examples}/${conf}.default ${nginx_confdir}/${conf}}}
}startupitem.create      yes
startupitem.pidfile     auto ${nginx_pidfile}
startupitem.executable  ${prefix}/sbin/nginx -g "daemon off;"notes "\A set of sample configuration files has been installed in ${nginx_examples}.\n\n\Additionally, the files [join ${auto_activate_confs} ", "] have been copied to ${nginx_confdir} if they didn't exist yet.\n\Adjust these files to your needs before starting Tengine."configure.args-append       --prefix=${prefix} \--with-http_ssl_module \--with-http_v2_module \--with-http_realip_module \--with-http_addition_module \--with-http_xslt_module \--with-http_geoip_module \--with-http_flv_module \--with-http_mp4_module \--with-http_gunzip_module \--with-http_gzip_static_module \--with-http_auth_request_module \--with-pcre \--with-threads \--with-stream \--with-stream_ssl_module \--with-stream_realip_module \--with-stream_geoip_module \--with-stream_ssl_preread_modulelivecheck.type      regexm
livecheck.url       ${homepage}/en/download.html

将文件保存至 ~/Ports/www/tengine/Portfile

添加自定义源

编辑 /opt/local/etc/macports/sources.conf,在最下方加上一行:

# 默认
rsync://rsync.macports.org/macports/release/tarballs/ports.tar.gz [default]
# 增加该行,注意替换用户名
file:///Users/用户名/Ports

运行 sudo portindex ~/Ports 加入索引

安装

运行 port info tengine 可以查看到信息后就能通过 install 安装了:

sudo port install tengine

配置

配置文件目录:/opt/local/etc/tengine,同样的修改 nginx.conf 文件即可

日志文件目录:/opt/local/var/log/tengine,建议修改文件夹权限方便通过编辑器查看日志:

sudo chown _www:admin /opt/local/var/log/tengine

运行目录:/opt/local/var/run/tengine

启停

sudo port load tengine
sudo port unload tengine
http://www.lryc.cn/news/506605.html

相关文章:

  • Git安装及基础学习
  • 【celery】任务有时候不执行
  • 【恶意软件检测论文】通过提取 API 语义来实现的一个新颖的安卓恶意软件检测方法
  • 什么,不用 Tomcat 也能运行 Java web?
  • 华为HarmonyOS实现跨多个子系统融合的场景化服务 -- 1 构建快速验证手机号Button
  • 王佩丰24节Excel学习笔记——第十一讲:Vlookup函数
  • 【QT实战の心情笔记】
  • 图像生成工具WebUI
  • 排查常见的 MySQL性能问题
  • 滑雪场管理系统
  • 西游记战力排名、笔记等
  • vue3 + js + vite创建的项目中配置svg图
  • c++ 找第一个只出现一次的字符
  • 在 Unity 6 中使用APV为您的世界创建全局照明的新方法(一)
  • Win11安装安卓子系统WSA
  • 利用两种方式分别实现单例模式(懒汉式、饿汉式)
  • js分页功能
  • Ubuntu20.04 编译运行 ORBSLAM2_with_pointcloud_map(以RGBD Orbbec Astra+为例)保姆级教程
  • MyBatis(四)
  • 【从零开始的LeetCode-算法】3285. 找到稳定山的下标
  • Docker常用命令总结~
  • 浅谈怎样系统的准备前端面试
  • 如何配置防火墙提高服务器安全性
  • java集合-Map HashMap 源码解析
  • 案例分享|企查查的数据降本增效之路
  • 图书馆管理系统(四)基于jquery、ajax--完结篇
  • 什么是Modbus协议网关?
  • Docker 容器中启用 SSH 服务
  • Linux系统—利用systemd管控系统以及服务详解(十四)
  • 人工智能 AI 大模型研究设计与实践应用技术毕业论文