ledc/webman
最新稳定版本:v8.3.13
Composer 安装命令:
composer require ledc/webman
包简介
webman配置模板,一键安装常用组件!
README 文档
README
安装 Installation
composer require ledc/webman
忽略扩展安装
composer require ledc/webman --ignore-platform-req=ext-redis --ignore-platform-req=ext-posix -W
运行环境
PHP版本:>=8.3
nginx配置
最佳实践,静态文件优先
location ^~ / {
try_files $uri $uri/ @webman;
}
location @webman
{
proxy_http_version 1.1;
proxy_read_timeout 120s;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_pass http://127.0.0.1:8787;
}
方案1,静态文件优先
location ^~ / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 代理条件:文件不存在&目录内不存在index.html
set $should_proxy 1;
if (-f $request_filename) {
set $should_proxy 0;
}
set $index_file "${request_filename}/index.html";
if (-f $index_file) {
set $should_proxy 0;
}
# 是否执行代理
if ($should_proxy = 1) {
proxy_pass http://127.0.0.1:8787;
}
}
方案2,静态文件优先
webman官方推荐的方案
location ^~ / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if (!-f $request_filename){
proxy_pass http://127.0.0.1:8787;
}
}
方案3,静态文件优先
适合静态打包/pages路径的项目
location ^~ / {
# 默认访问、index.html 或 /pages 开头的路径,返回 index.html
location ~* (^/$|^/index\.html$|^/pages/) {
try_files $uri $uri/ /index.html;
}
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if (!-f $request_filename){
proxy_pass http://127.0.0.1:8787;
}
}
长连接
location = /websocket
{
proxy_pass http://127.0.0.1:8788;
proxy_read_timeout 300s;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
统计信息
- 总下载量: 67
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-10