本文介绍源支付V8的安装部署教程,安装前请细节阅读此安装教程
1、创建站点
在宝塔面板创建站点,注意php版本必须选择8.1版本。
2、解除PHP函数禁用
- 打开宝塔面板,从侧边菜单进入“软件商店”。
- 找到已安装的PHP版本,点击“设置”。
- 在设置页面中,点击“禁用函数”标签,删除
putenv,proc_open,popen,passthru,pcntl_signal,pcntl_alarm这6个函数的禁用状态。
![图片[1]-源支付V8安装部署教程](/wp-content/uploads/replace/38d989eea784307d699ececd5ce96e9a.png)
- 返回设置页面,点击“服务”,然后选择“重启”以重新启动PHP服务。
3、程序上传流程
- 在本地电脑下载并保存源码压缩包。
- 登录宝塔面板,通过左侧菜单进入“网站”,点击您的新站点以进入根目录。
- 点击左上角的“上传”按钮,选择“上传文件”,找到并选择“YPay程序.ZIP”,点击“开始上传”并等待上传完成后关闭窗口。
- 在根目录下解压此压缩包,等待解压完成。
4、站点配置
- 登录宝塔面板,从左侧菜单选择“网站”后点击“设置”。
- 在“网站目录”选项中,选择运行目录为“Public”,然后点击“保存”。
![图片[2]-源支付V8安装部署教程](/wp-content/uploads/replace/a64ab9de0ed5e655101997c14fca9544.png)
- 进入“伪静态”设置,将以下Nginx伪静态规则复制并填入相应的文本框,完成后点击“保存”:
如果更新V1.7.3版本之后遇到首页白屏,替换一下伪静态即可,下面是伪静态内容
# 禁止访问 runtime 和 application 目录location ~* (runtime|application)/ { <strong>return</strong> 403;}# 支付和通知相关的重写规则location ~ ^/api/notify/ { rewrite ^(.*)$ /index.php?s=$1 last; break;}location ~ ^/api/OAuthLogin/notify { rewrite ^(.*)$ /index.php?s=$1 last; break;}location ~ ^/pay/payment { rewrite ^(.*)$ /index.php?s=$1 last; break;}location ~ ^/alipaycashier { rewrite ^(.*)$ /index.php?s=$1 last; break;}location ~ ^/pay/cashier { rewrite ^(.*)$ /index.php?s=$1 last; break;}# 根路径配置location / { # 处理首页访问 <strong>if</strong> ($request_uri = "/") { rewrite ^/$ /index.php?s=/api/index/home&server=1 last; } # 处理跨域 OPTIONS 预检请求 <strong>if</strong> ($request_method ~* OPTIONS) { add_header Access-Control-Max-Age '86400'; add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Allow-Credentials 'true'; add_header Access-Control-Allow-Methods 'GET, POST, PATCH, PUT, DELETE, OPTIONS'; <strong>return</strong> 204; } # 首页优先访问 index.html,实现隐藏 index.html 的效果 index index.html index.php error/index.html; # URL 重写规则 set $server 0; # 判断 server 参数 <strong>if</strong> ($request_uri ~* "server=1") { set $server 1; } <strong>if</strong> ($http_server) { set $server 1; } # 重写规则执行 <strong>if</strong> ($server = 1) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } # 其他请求尝试访问静态资源,如果不存在则访问 index.html try_files $uri $uri/ /index.html;}
![图片[3]-源支付V8安装部署教程](/wp-content/uploads/replace/b34ab03c0ac41f59de112308d6f2f5f4.png)
Apache的伪静态如下(待测试):
location ~* (runtime|application)/{ <strong>return</strong> 403;} location ~ ^/api/notify/ { rewrite ^(.*)$ /index.php?s=$1 last; break;} location ~ ^/api/OAuthLogin/notify { rewrite ^(.*)$ /index.php?s=$1 last; break;} location ~ ^/pay/payment { rewrite ^(.*)$ /index.php?s=$1 last; break;} location ~ ^/alipaycashier { rewrite ^(.*)$ /index.php?s=$1 last; break;} location ~ ^/pay/cashier { rewrite ^(.*)$ /index.php?s=$1 last; break;}location ~ ^/getPay { rewrite ^(.*)$ /index.php?server=1 last; break;}location / { <strong>if</strong> ($request_uri = "/") { rewrite ^/$ /index.php?s=/api/index/home&server=1 last; } <strong>if</strong> ($request_method ~* OPTIONS) { add_header Access-Control-Max-Age '86400'; add_header Access-Control-Allow-Origin '*'; add_header Access-Control-Allow-Headers '*'; add_header Access-Control-Allow-Credentials 'true'; add_header Access-Control-Allow-Methods 'GET, POST, PATCH, PUT, DELETE, OPTIONS'; <strong>return</strong> 204; } # 将 index.html 放在第一位可以实现隐藏 index.html index index.html index.php error/index.html; # 这一段为 URL重写规则 请确保存在 set $server 0; <strong>if</strong> ($request_uri ~* "server=1") { set $server 1; } <strong>if</strong> ($http_server) { set $server 1; } <strong>if</strong> ($server = 1) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } try_files $uri $uri/ /index.html; # 结束}
安装扩展
- 在浏览器中打开您的网站域名,进入安装界面。
- 下载对应的Swoole Loader扩展文件。
![图片[4]-源支付V8安装部署教程](/wp-content/uploads/replace/0203aaeb162e33c771e5361893dc4ac2.png)
- 记下或复制对应PHP版本的扩展安装目录。
- 登录宝塔面板,从左侧菜单选择“网站”,点击进入根目录。
- 将复制的目录路径粘贴到文件管理器的地址栏并回车。
![图片[5]-源支付V8安装部署教程](/wp-content/uploads/replace/dc5359599349cf593f959e34a1ff229d.png)
- 上传已下载的Swoole Loader扩展文件到此目录。
![图片[6]-源支付V8安装部署教程](/wp-content/uploads/replace/52a105293a7e1764e0b54cc1e51b56a3.png)
返回宝塔面板主界面,选择左侧菜单“软件商店”,找到并点击PHP8.1设置。
将下载的扩展配置内容复制到PHP配置文件的底部并保存。
![图片[7]-源支付V8安装部署教程](/wp-content/uploads/replace/aa118c45c3d8ec6835febf02e052f382.png)
安装swoole5扩展,如下图所示:
![图片[8]-源支付V8安装部署教程](/wp-content/uploads/replace/92bc3a00271211d6089f136834eb1627.png)
在宝塔面板左侧菜单中选择“服务”,重启PHP服务。
![图片[9]-源支付V8安装部署教程](/wp-content/uploads/replace/012b69ea5c6070194a9412b5eedbc4a6.png)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END








暂无评论内容