刷新添加到Apache HTTPD的别名目录

flvtvl50  于 2023-01-21  发布在  Apache
关注(0)|答案(1)|浏览(103)

我使用Apache的httpd <Directory>公开文件,如下所示

Alias /getfiles "/web/playbooks/tmpfiles"

<Directory "/web/playbooks/tmpfiles">
     Options Indexes MultiViews
     AllowOverride None
     Require all granted
</Directory>

有了这个,我就可以通过下面的Web浏览器URL访问/web/playbooks/tmpfiles中的所有文件/文件夹。

http://<server>:<port>/getfiles/<anyfile.txt>

是否可以刷新上述URL,以便我可以定期查看/web/playbooks/tmpfiles内文件/文件夹的最新更改?
任何解决办法都很好。

f2uvfpb9

f2uvfpb91#

你可以尝试通过html本身的指令让客户端自动刷新,而不是尝试做一些奇怪的事情,这可能不在http规范中(我可能错了)。
例如,根据您的目录条目,load module_autoindex module然后使用以下配置:

<Directory /web/playbooks/tmpfiles>
     Options Indexes MultiViews
     IndexOptions FancyIndexing
     IndexHeadInsert "<meta http-equiv=\"refresh\" content=\"10\">"
     AllowOverride None
     Require all granted
</Directory>

这样一来,Apache httpd就会在html中添加该标记,客户端就会知道它必须每10秒自动刷新一次页面。一般来说,不建议将此值设置得太低,所以10秒或更高可能对您来说是合适的。

相关问题