ch3.ng

nginx 拦截同一端口的不同资源


不知道写什么

能这么配置的在我看来应该没有,但是留着吧,说不定哪天自己SB了,会用上了呢.这种事儿谁说得准呢!

server {
    listen       75;
    server_name  blog.well-known.me;

    location /a/b/c/d/ {
        proxy_pass      http://127.0.0.1:9090;
        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;
    }

    location /a/b/c/e/ {
        proxy_pass      http://127.0.0.1:9090;
        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;
    }
    #其他路径默认访问
    location / {
        proxy_pass http://192.168.0.21:75;
        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;
    }
}