server {
listen 80;
server_name localhost;
add_header X-Cache $upstream_cache_status;#查看缓存情况
add_header X-Via nginx;
#只允许GET|POST方法
if ($request_method !~* GET|POST) {
return 405;
}
# if ($server_protocol !~* "HTTP/2.0") {
# return 444;
# }
location / {
#实现全域重定向
rewrite ^ /cfdj/ redirect;
}
location /cfdj {
#站点根目录是/nginx/data,代理静态文件访问
alias /nginx/data/;
index index.html index.htm;
#设置图片禁止读取缓存
add_header Cache-Control no-store;
#实现域名下