nginx: Example: Reverse Proxy

 15th February 2022 at 5:19pm

反向代理配置示例:

server {
    listen          80;
    server_name     fm-api.oa.com;

    location /static/ {
        root    /usr/local/services/radio_api_server-1.0;
    }

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:13001;
        proxy_redirect off;
    }
}

设的几个 header 重要,但是还不清楚具体含义和作用。