nginx 7层反向代理

server {
    listen 800;
    proxy_cache pcache;
    proxy_cache_key $scheme$proxy_host$request_uri; 
    proxy_cache_methods GET HEAD; 
    proxy_cache_min_uses 1; 
    proxy_cache_valid 200 302 10m;
    proxy_cache_valid 301      1h;
    proxy_cache_valid any      1m;
    proxy_cache_use_stale off;

    location /admin/ {
        proxy_pass http://1.1.1.1:8980/admin/;
        proxy_set_header Host       $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_buffering on;
        proxy_buffer_size 1024k;
        proxy_buffers 8 1024k;
        proxy_max_temp_file_size 0;
        proxy_temp_file_write_size 1024k;
        access_log logs/1_1_access.log;
    }
}

An unchanged “Host” request header field can be passed like this:
proxy_set_header Host $http_host;

转载于:https://blog.51cto.com/sonlich/2394955

你可能感兴趣的:(nginx 7层反向代理)