Identify crawler nginx configuration

摘自个人印象笔记:https://app.yinxiang.com/fx/2147ab80-841e-4689-868b-e094580125a3
location / {
#爬虫的转发配置 start
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($http_user_agent ~* "Sogou Pic Spider|Baiduspider|Baiduspider-render|YisouSpider|Sogou web spider|Bytespider|360Spider|Googlebot|YodaoBot") {
proxy_pass http://localhost:4000;
}
#爬虫的转发配置 end
#vue前端的文件夹 start
alias /app/mysite-front/dist/;
gzip_static on; #查找静态文件
#vue前端的文件夹 end
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

Maybe it works!

Guess you like

Origin blog.csdn.net/AJian759447583/article/details/132224210