update
This commit is contained in:
parent
b26079b313
commit
2b85736f53
@ -1,7 +1,7 @@
|
||||
---
|
||||
title: "Nginx 笔记"
|
||||
date: 2019-10-30T11:47:55+08:00
|
||||
lastmod: 2024-11-25T22:23:00+08:00
|
||||
lastmod: 2024-11-28T13:22:00+08:00
|
||||
tags: ["nginx", "https", "ssl", "反向代理"]
|
||||
categories: ["web"]
|
||||
---
|
||||
@ -87,6 +87,38 @@ categories: ["web"]
|
||||
try_files _ @app;
|
||||
```
|
||||
|
||||
## error_page
|
||||
- 语法
|
||||
```
|
||||
error_page code ... [=[response]] uri;
|
||||
code 只能是 4xx 或 5xx
|
||||
# uri 可以包含变量,内部重定向请求,方法是 GET
|
||||
```
|
||||
|
||||
- 位置: http, server, location, if in location
|
||||
- 5xx 重定向到 /fk.html
|
||||
```
|
||||
error_page 500 502 503 504 /fk.html;
|
||||
```
|
||||
|
||||
- 指定响应码
|
||||
```
|
||||
error_page 404 =200 /fk.html;
|
||||
# 404 重定向到 /fk.html,返回 200
|
||||
|
||||
error_page 401 = /proxy/api;
|
||||
# 401 重定向到一个反代 location,返回反代接口的响应码
|
||||
```
|
||||
|
||||
- url 重定向
|
||||
```
|
||||
error_page 403 http://another-site/a/b/c;
|
||||
# 403 重定向到 302,返回 url
|
||||
|
||||
error_page 403 =301 http://another-site/a/b/c;
|
||||
# 403 重定向到 301,返回 url
|
||||
```
|
||||
|
||||
## 客户端访问控制
|
||||
- deny all 拒绝全部访问
|
||||
- deny 192.168.1.0/24 拒绝指定网段
|
||||
@ -100,7 +132,6 @@ categories: ["web"]
|
||||
location / {
|
||||
root /var/www/html/;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user