需求
只能访问生产机器一个ip、有限port的外网机,要查看spark 正在运行task和history的情况,还有能够查看日志,下载日志
nginx转发配置
#nginx -t 可以查看到当前使用的配置文件位置
#location 前缀字符窜匹配时 自动就截取了后段部分拼接到http_proxy中
server {
listen 8091;
server_name localhost;
set $ip1 xxx;
set $ip2 xxx;
location ^~/4040/ {
proxy_pass http://$ip1:4040/;
}
location ^~/8084/ {
proxy_pass http://$ip2:8084/;
}
location ^~/log1/8042/ {
proxy_pass http://$ip1:8042/;
}
location ^~/log2/8042/ {
proxy_pass http://$ip2:8042/;
}
location ^~/download {
alias /;
add_header Content-Type "application/octet-stream";
}
}
#listen 8091端口,并且访问当前nginx的http请求(如果是写域名,多个域名指到当前nginx所在服务器,猜想域名相同可能会不行,未验证,都配置localhost省事)
#set $varname varvalue 在nginx中变量赋值,全都是字符窜,减少硬编码后期变更的麻烦