Nginx做非80端口转发

server {
    server_name git.test.com
    listen 80;

    error_log  /data/logs/nginx/git.error.log;
    access_log /data/logs/nginx/git.access.log;

    location / {
        proxy_pass http://127.0.0.1:3000;
        #获取客户端真实IP,X-Real-IP是请求的真实IP,X-Forwarded-For表示请求是由谁发起的
        proxy_set_header Host $host:80;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

你可能感兴趣的:(nginx)