nginx 配置反向代理

一、首先进入/usr/local/nginx/conf中,修改nginx.conf文件
二、配置信息
在server{}中

location ^~/api {
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_http_version 1.1;
            
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_buffering off;
            rewrite ^/api/(.*)$ /$1 break;
            proxy_pass http://localhost:8088; //代理转发地址
        }

你可能感兴趣的:(nginx,运维)