摘要:
推荐的目录结构 /etc/nginx/ ├── nginx.conf # 主配置文件 ├── mime.types # MIME 类型 ├── conf.d/ # 通用配置 │ ├── security.conf # 安全配置 │ ├── ssl.conf # SSL 通用配置 │ ├── gzip 阅读全文
posted @ 2026-01-05 16:57
蘑菇味的花魂
阅读(1)
评论(0)
推荐(0)
摘要:
防止常见攻击 # 限制请求方法 location / { limit_except GET POST { deny all; 表示拒绝其他所有方法 } } # 防止 SQL 注入和 XSS(基础防护)server或者location块 if ($request_uri ~* "(union|sele 阅读全文
posted @ 2026-01-05 16:51
蘑菇味的花魂
阅读(4)
评论(0)
推荐(0)
摘要:
Upstream 配置 一般位于 nginx.conf 文件的 http 块中,可以在 server 全局块中引用。 upstream backend 定义的是一组后端服务器,而后面的 server 块定义的是如何处理客户端请求并将它们转发到这些后端服务器。 # 定义后端服务器组 upstream 阅读全文
posted @ 2026-01-05 16:43
蘑菇味的花魂
阅读(3)
评论(0)
推荐(0)
摘要:
Location 匹配规则 # 精确匹配(优先级最高) location = /exact { # 只匹配 /exact } # 正则匹配(区分大小写) location ~ \.php$ { # 匹配以.php结尾的请求 } # 正则匹配(不区分大小写) location ~* \.(jpg|jp 阅读全文
posted @ 2026-01-05 16:36
蘑菇味的花魂
阅读(3)
评论(0)
推荐(0)
摘要:
文件位置 Linux:/etc/nginx/nginx.conf macOS:/usr/local/etc/nginx/nginx.conf windows:<安装目录>/conf/nginx.conf 文件层级: 全局块、events块、http块(全局块+server块(server全局块+lo 阅读全文
posted @ 2026-01-05 16:09
蘑菇味的花魂
阅读(11)
评论(0)
推荐(0)

浙公网安备 33010602011771号