浏览 789
Cache-Control设置了max-age没有覆盖no-cache,no-store,响应头出现三个Cahce-control
按点赞数排序
按时间排序
请提供详细配置信息。
location / {
add_header Cache-Control max-age=2592000;
root html;
index index.html index.htm;
}
我使用如上配置,服务端响应如下:
HTTP/1.1 200 OK
Server: nginx/1.20.2
Date: Fri, 02 Sep 2022 09:10:55 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Wed, 20 Jul 2022 12:09:37 GMT
Connection: keep-alive
ETag: "62d7f081-264"
Cache-Control: max-age=2592000
Accept-Ranges: bytes
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
0
回答于2022-10-25 15:25
你应该有一个默认的服务器来捕捉所有的,你可以返回404
或更好地不响应(会节省一些带宽),通过返回444
它是nginx特定的HTTP响应,只需关闭连接并返回任何内容
try_files file ... =404; 可以指定找不到时,返回的消息码。 默认不指定找不到的话,会以最后的参数从新location 从定向。