技术解析
搭建了 mesos+marathon 的环境,直接访问 192.168.0.2:5050 ( mesos )和 192.168.0.2:8080 ( marathon )是可以的。 但想利用另外一个 IP 实现集中访问,比如 192.168.0.99/mesos , 192.168.0.99/marathon 这种访问方式。 配置了一下,试了下面几种配置方式,但都报 404 错误,
server {
listen 80;
server_name 192.168.0.99;
location /mesos {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.2:5050;
}
location /marathon {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.2:8080;
}
}
或者
server {
listen 80;
server_name 192.168.0.99;
location /mesos/(.) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.2:5050;
}
location /marathon/(.) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.2:8080;
}
}
或者
server {
listen 80;
server_name 192.168.0.99;
location /mesos {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.2:5050/;
}
location /marathon {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://192.168.0.2:8080/;
}
}
实现 192.168.0.99/mesos , 192.168.0.99/marathon 这种访问方式,要如何配置呢?