Skip to content

Commit

Permalink
✨ feat: 对$进行转义操作
Browse files Browse the repository at this point in the history
  • Loading branch information
nichuanfang committed Nov 6, 2023
1 parent 725e521 commit 3ea7835
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions linux/bash/step2/vps/deploy_nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ http {
root /root/blog;
index index.html index.htm;
# 将缓存策略用if语句写在location里面,生效了
if ($request_filename ~* .*\.(?:htm|html)$) {
if (\$request_filename ~* .*\.(?:htm|html)$) {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
if ($request_filename ~* .*\.(?:js|css)$) {
if (\$request_filename ~* .*\.(?:js|css)$) {
expires 30d;
}
if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|woff|woff2|webp)$) {
if (\$request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|woff|woff2|webp)$) {
expires 30d;
}
Expand Down Expand Up @@ -238,14 +238,14 @@ http {
root /root/docs;
index index.html index.htm;
# 将缓存策略用if语句写在location里面,生效了
if ($request_filename ~* .*\.(?:htm|html)$) {
if (\$request_filename ~* .*\.(?:htm|html)$) {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
if ($request_filename ~* .*\.(?:js|css)$) {
if (\$request_filename ~* .*\.(?:js|css)$) {
expires 30d;
}
if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|woff|woff2|webp)$) {
if (\$request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|woff|woff2|webp)$) {
expires 30d;
}
Expand Down

0 comments on commit 3ea7835

Please sign in to comment.