# 6.nginx 代理配置
- 同一个端口设置多个域名,根据dns解析原理设置本地
hosts
// 同一个端口设置多个域名
server {
listen 80;
server_name ncuniversitylxz.xin;
#return 302 https://$host$request_uri;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
}
server{
listen 80;
server_name ncuxz.fun;
location / {
root html;
index index.html index.htm;
}
}
proxy_set_header :在将客户端请求发送给后端服务器之前,更改来自客户端的请求头信息。
2.代理服务器缓存设置:cache 路径 在windows用相对路径,在linux用绝对路径
设置了代理服务器缓存后请求效果
3.请求头一致才使用代理缓存,代理缓存验证的响应头为Vary
