安全令牌
防止机器人刷请求
Idc环境中没有添加token的连接, 直接被location到404页面
token在ngnix的http协议中的流程:
location / {
proxy_pass http://localhost:8000;
proxy_set_header X-Real-IP $remote_addr;
}
upstream.com {
server 192.168.5.126:80;
server 192.168.5.27:80;
}
server{
listen 80;
server_name a.com;
location / {
proxy_pass http://a.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
/usr/local/nginx/conf/proxy.conf
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding 'gzip';
client_max_body_size 100m;
client_body_buffer_size 256k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_buffer_size 512k;
proxy_buffers 8 512k;
proxy_busy_buffers_size 512k;
proxy_temp_file_write_size 512k;
这样配置动态文件无法被缓存,而html 文件可以被缓存
当访问http://abc.test.com跳转到http://www.test.com/test/abc/
rewrite命令
server {
listen 80;
server_name*.test.com;
if ( $http_host ~* "^(.*)\.test\.com$") {
set $domain $1;
rewrite ^(.*)http://www.test.com/test/$domain/ break;
}
}