文档说明:只记录关键地方; 发布时间: 2024-06-20
需求: linux 、macos 环境下,免构建安装 nginx php-fpm 快速运行 php 项目
运行环境: linux、 macos
状态: 已完成
实现原理: 静态编译 nginx 、php-fpm
例子: 快速运行 导航站点 onenav、Z-BlogPHP博客 、Discuz 论坛 、ThinkAdmin、fusionpbx
下载 nginx 、php-fpm脚本 和 运行时
| |
| git clone https://gitee.com/jingjingxyk/quickstart-nginx-php-fpm.git |
| |
| cd quickstart-nginx-php-fpm |
| |
| |
| |
| bash setup-nginx-runtime.sh |
| |
| |
| |
| bash setup-php-fpm-runtime.sh |
| |
| |
| bash start.sh |
| |
| |
| bash reload.sh |
| |
| |
| bash stop.sh |
| |
| |
| |
实操例子一: 快速 运行一个书签导航站点 onenav
| |
| cd /home/jingjingxyk |
| git clone https://github.com/helloxz/onenav.git |
| |
| cd quickstart-nginx-php-fpm |
| |
| |
| bash setup-nginx-runtime.sh |
| |
| |
| bash setup-php-fpm-7.4-runtime.sh |
| |
| bash start.sh |
| |
| |
| vi nginx.conf |
| |
| root /home/jingjingxyk/onenav ; |
| |
| |
| bash reload.sh |
| |
| |
| |
实操例子二: 快速 运行一个博客 Z-BlogPHP博客程序
| |
| cd /home/jingjingxyk/ |
| |
| git clone https://github.com/zblogcn/zblogphp.git |
| cd quickstart-nginx-php-fpm |
| |
| bash setup-nginx-runtime.sh |
| |
| |
| bash setup-php-fpm-runtime.sh |
| bash start.sh |
| |
| |
| vi nginx.conf |
| |
| root /home/jingjingxyk/zblogphp ; |
| |
| |
| bash reload.sh |
| |
| |
| |
实操例子三: 快速 运行 Discuz 论坛 程序
| |
| cd /home/jingjingxyk/ |
| |
| git clone -b v3.5-20231221 https://gitee.com/Discuz/DiscuzX.git |
| |
| cd quickstart-nginx-php-fpm |
| |
| bash setup-nginx-runtime.sh |
| |
| |
| bash setup-php-fpm-runtime.sh |
| bash start.sh |
| |
| |
| vi nginx.conf |
| |
| root /home/jingjingxyk/DiscuzX/upload ; |
| |
| |
| bash reload.sh |
| |
| |
| |
实操例子四: 快速 运行 ThinkAdmin 程序
| |
| cd /home/jingjingxyk/ |
| |
| git clone https://gitee.com/zoujingli/ThinkAdmin.git |
| |
| cd quickstart-nginx-php-fpm |
| |
| bash setup-nginx-runtime.sh |
| |
| |
| bash setup-php-fpm-runtime.sh |
| bash start.sh |
| |
| |
| vi nginx.conf |
| |
| root /home/jingjingxyk/ThinkAdmin/public/ ; |
| |
| location / { |
| try_files $uri /index.php$request_uri; |
| } |
| location ~ ^/index\.php(/|$) { |
| fastcgi_pass 127.0.0.1:9000; |
| fastcgi_split_path_info ^(.+\.php)(/.*)$; |
| fastcgi_param PATH_INFO $fastcgi_path_info; |
| include fastcgi_params; |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
| fastcgi_hide_header X-Powered-By; |
| } |
| |
| |
| bash reload.sh |
| |
| |
| |
备注 切换 nginx php-fpm 版本
修改下载脚本setup-php-fpm-runtime.sh 、setup-nginx-runtime.sh 里 nginx 、php-fpm版本 配置即可
参考文档:
- quickstart-nginx-php-fpm
- php nginx 配置
- symfony web server configurationg for nginx
- laravel web server configurationg for nginx
- wordpress web server configurationg for nginx
- nextcloud web server configurationg for nginx
- 使用nginx部署网站
- nginx 伪静态配置参考
- php-fpm www.conf
- php-fpm php-fpm.conf
- build-static-nginx
- swoole-cli
- php-cli
- php-fpm
- Swoole-Cli 5.0.1:PHP 的二进制发行版
- ELF ( Executable and Linkable Format ) 可执行和可链接格式 首字母缩略词 解释
快速准备php运行时
| |
| curl https://github.com/swoole/swoole-cli/blob/main/setup-php-runtime.sh?raw=true | bash -s -- --mirror china |
| |
| curl https://gitee.com/jingjingxyk/swoole-cli/raw/main/setup-php-runtime.sh | bash -s -- --mirror china |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)