nginx控制浏览器缓存

xiaodunan / 2023-05-04 / 原文

  1. 创建一个html文件
vim cache.html

<html>
    <body>
        <h1>
            Hello,Nginx ~ !~
        </h1>
    </body>
</html>
  1. 配置conf文件,这里配置在imooc.conf,可以自定义
 location /static {
        alias /home/imooc;
        }

img

  1. 检查语法,刷新配置文件
../sbin/nginx -t
../sbin/nginx -s reload
  1. 浏览器访问

img