全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1274|回复: 4

[nginx] nginx 匹配动态地址规则怎么写

[复制链接]
发表于 2023-9-24 07:26:51 | 显示全部楼层 |阅读模式
像这种动态地址在nginx配置里面应该怎么匹配

/read.php?aid=1&cid=2

  1. location ~ .*read.php\?aid\=([0-9]+)\&cid\=([0-9]+)
  2. {
  3.         fastcgi_pass unix:/tmp/php-cgi-73.sock;
  4.         include enable-php-73.conf;
  5.         add_header Nginx-Cache "$upstream_cache_status";
  6.         fastcgi_cache cgi_one;
  7.         fastcgi_cache_valid 200 301 302 1d;
  8.         fastcgi_cache_valid 404 500 502 503 504 0s;
  9.         fastcgi_cache_valid any 0s;
  10. }
复制代码

这样好像匹配不到

来个大佬指导下

发表于 2023-9-24 07:32:42 来自手机 | 显示全部楼层
发表于 2023-9-24 08:29:32 来自手机 | 显示全部楼层
query_string 或者 args 匹配参数
发表于 2023-9-24 08:30:33 来自手机 | 显示全部楼层
location 只负责  URL的匹配,参数需要单独在匹配
发表于 2023-9-24 09:37:43 来自手机 | 显示全部楼层
args[0] args[1]匹配参数
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-28 20:01 , Processed in 0.058323 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表