mirror of
https://github.com/QYG2297248353/appstore-1panel.git
synced 2025-03-06 15:40:32 +08:00
添加:Umami 安装说明
Signed-off-by: 萌森 <qyg2297248353@163.com>
This commit is contained in:
parent
fdc5c8f1b1
commit
e4841305cf
@ -40,6 +40,103 @@ Umami 会自动理解带有 UTM 参数的链接,并让您根据 UTM 查看和
|
||||
>
|
||||
> 密码: umami
|
||||
|
||||
## 反向代理
|
||||
|
||||
> Nginx
|
||||
|
||||
如果您的请求头中存在自定义字段,请修改:
|
||||
|
||||
```text
|
||||
add_header Access-Control-Allow-Headers '*'
|
||||
```
|
||||
|
||||
以下配置修复 ipv6 地址无法收集的问题:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
...
|
||||
|
||||
add_header Content-Security-Policy 'frame-ancestors *';
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
|
||||
add_header Access-Control-Allow-Headers 'x-umami-cache,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
|
||||
location /api/send {
|
||||
content_by_lua_block {
|
||||
local cjson = require "cjson"
|
||||
|
||||
local function is_ipv6_address(hostname)
|
||||
local match = hostname:match("^[%x:]+$")
|
||||
return match ~= nil
|
||||
end
|
||||
|
||||
ngx.req.read_body()
|
||||
local data = ngx.req.get_body_data()
|
||||
|
||||
if data then
|
||||
local decoded_data = cjson.decode(data)
|
||||
local hostname = decoded_data.payload.hostname
|
||||
|
||||
if is_ipv6_address(hostname) then
|
||||
local new_hostname = "127.0.0.1"
|
||||
decoded_data.payload.hostname = new_hostname
|
||||
|
||||
local modified_data = cjson.encode(decoded_data)
|
||||
ngx.req.set_body_data(modified_data)
|
||||
end
|
||||
end
|
||||
|
||||
ngx.exec("@proxy")
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_hide_header 'Access-Control-Allow-Origin';
|
||||
proxy_hide_header 'Content-Security-Policy';
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
}
|
||||
|
||||
location @proxy {
|
||||
proxy_hide_header 'Access-Control-Allow-Origin';
|
||||
proxy_hide_header 'Content-Security-Policy';
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
极简配置:
|
||||
|
||||
```nginx
|
||||
add_header Content-Security-Policy 'frame-ancestors *';
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
add_header Access-Control-Allow-Methods '*';
|
||||
add_header Access-Control-Allow-Headers '*';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
return 204;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_hide_header 'Access-Control-Allow-Origin';
|
||||
proxy_hide_header 'Content-Security-Policy';
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
Loading…
x
Reference in New Issue
Block a user