惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Blog — PlanetScale
Blog — PlanetScale
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
L
LangChain Blog
F
Fortinet All Blogs
C
Check Point Blog
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
J
Java Code Geeks
月光博客
月光博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
宝玉的分享
宝玉的分享
Jina AI
Jina AI

NGINX

有用 Nginx UI 的朋友吗?这玩意是不是时不时将磁盘 IO 打满? fail2ban 保护 nginx 方案 麦当劳服务模式是 nginx,肯德基服务模式是 apache,这样理解对不对? oracleusa.ml 的实现原理 尝试自己配置转发后端请求的时候有个疑问 请教 Nginx 时完整的 SSL 刷新教程或者脚本 问问大家 nginx 日志流量分析用什么方案? nginx 二级目录反向代理是不是有先天缺陷? nginx rewrite 指令的问题 请问下为啥微信客户端访问到 nginx 没有参数了? 有兄弟们用 nginx proxy manager(或者其他图形化工具)来管理 nginx 反向代理的吗? 请问 Nginx 怎么添加 CORS 白名单? 使用 nginx 监听已被监听的端口, reload 不会失败, 但会导致其他配置不生效. nginx 如何获取/打印完整代理路径? Nginx 四层反代 QUIC 如何传递客户端 IP 关于 windows 下面重启之后 nginx 的问题 我是不是可以反向代理个 V2EX 网站? 用 nginx 做的 xai 的转发好像一直有问题 请教一个 Nginx 配置和浏览器强制 http 转 https 问题 nginx proxy manager ipv6 反代指向内网 ipv4 局域网地址,还可以这样操作🤔? 关于 Nginx 反向代理性能调优的问题,求指导🙏 nginx 配置根据请求头分发问题 用过 nginx-proxy-manager 请进, 咨询个问题. 我有一个端口转发问题,求大佬们协助 使用 Nginx 代理 Emby 服务器,浏览器可以访问但是客户端连不上 小白在使用 Nginx proxy manager 遇到问题,请大佬们指教。 请教下 nginx 反代配置 nginx 配置问题求解答 Nginx 流量异常,请大佬支招~ nginx 读取 ssl 证书的权限问题请教
问个 nginx 配置问题
kyonn · 2025-08-01 · via NGINX

抄来的 nginx 配置,第 1 个 location 的正则表达式不太确定是否正确。按照 AI 的解答,用于匹配下面这几种路径。实测下来,http git clone 也是失败的,未匹配第 1 个 location 。有几个疑点:

  1. 类似这种多行的正则,每一行之间是什么关系?按照 AI 的解答看上去是或的关系,但是没找到正则规则的依据。
  2. 每一行正则结尾是 空格 + 单引号,这个不知道又是什么规则?
  • /git/xxx/HEAD (获取仓库的 HEAD 文件)
  • /git/xxx/info/refs (获取仓库引用信息)
  • /git/xxx/objects/...(处理 Git 对象)
  • /git/xxx/git-upload-pack

location ~ "(?x)^/git(?<path>/.*/(?:HEAD '
                             info/refs '
                             objects/(?:info/[^/]+ '
                                        [0-9a-f]{2}/[0-9a-f]{38} '
                                        pack/pack-[0-9a-f]{40}\.(?:pack '
                                                                   idx)) '
                             git-upload-pack))$" {
        error_page 491 = @auth;
        if ($query_string = service=git-receive-pack) {
                return 491;
        }
        client_max_body_size                    0;

        fastcgi_param   SCRIPT_FILENAME         /usr/lib/git-core/git-http-backend;
        include         fastcgi_params;
        fastcgi_param   GIT_HTTP_EXPORT_ALL     "";
        fastcgi_param   GIT_PROJECT_ROOT        /srv/git;
        fastcgi_param   PATH_INFO               $path;

        fastcgi_param   REMOTE_USER             $remote_user;
        fastcgi_pass    unix:/var/run/fcgiwrap.socket;
}
location ~ "^/git(?<path>/.*/git-receive-pack)$" {
        error_page 491 = @auth;
        return 491;
}
location @auth {
        auth_basic            "Git write access";
        auth_basic_user_file  /srv/git/.htpasswd;

        client_max_body_size                    0;

        fastcgi_param   SCRIPT_FILENAME         /usr/lib/git-core/git-http-backend;
        include         fastcgi_params;
        fastcgi_param   GIT_HTTP_EXPORT_ALL     "";
        fastcgi_param   GIT_PROJECT_ROOT        /srv/git;
        fastcgi_param   PATH_INFO               $path;

        fastcgi_param   REMOTE_USER             $remote_user;
        fastcgi_pass    unix:/var/run/fcgiwrap.socket;
}
location ~ ^/git(?<path>/.*)$ {
        alias /usr/share/cgit;
        try_files $1 @cgit;
}
location @cgit {
        include         fastcgi_params;
        fastcgi_param   SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
        fastcgi_param   PATH_INFO       $path;
        fastcgi_param   QUERY_STRING    $args;
        fastcgi_param   HTTP_HOST       $server_name;

        fastcgi_param   CGIT_CONFIG     /srv/git/.cgitrc;

        fastcgi_pass    unix:/var/run/fcgiwrap.socket;
}