gpt4 book ai didi

nginx - 如何使用 sub_filter 来提供静态文件?

转载 作者:行者123 更新时间:2023-12-04 18:33:31 28 4
gpt4 key购买 nike

我需要提供带有内容替换的静态 html 文件。

我尝试:

server {
root /var/www/test;
location / {
gzip off;
sub_filter test test1;
}
}

但它不起作用 :( 内容没有被修改。

内容类型:文本/html

nginx -V:

nginx version: nginx/1.9.4
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1k 8 Jan 2015
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt=-Wno-error --with-http_stub_status_module --with-http_sub_module

curl http://example.com/test.html -我:

响应头:

HTTP/1.1 200 OK
Server: nginx/1.9.4
Date: Sat, 12 Sep 2015 21:43:03 GMT
Content-Type: text/html
Content-Length: 5
Last-Modified: Fri, 11 Sep 2015 17:27:30 GMT
Connection: keep-alive
ETag: "55f30f02-5"
Accept-Ranges: bytes

最佳答案

因此,虽然您的问题没有显示未更改的实际内容,导致对该问题产生怀疑,但我遇到了同样的问题。

我遇到了 this thread提交者最终声称更改他的服务器端口导致它开始工作。我自己发现这很愚蠢,但它对我有用。

这可能只是破坏了我浏览器中的缓存响应,因此如果您的代理缓存响应(您显示 curl,所以这可能是 n/a),您也可以尝试清除缓存。此外,请尝试使用 sub_filter_type 指定 mime 类型,尽管鉴于您的响应似乎是 text/html,我怀疑这是问题所在,因为它是 stated default .

关于nginx - 如何使用 sub_filter 来提供静态文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32532113/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com