nginx部署Go程序

程序启动后修改nginx配置文件

     location /api {

         proxy_set_header X-Real-IP $remote_addr;    
         proxy_pass http://127.0.0.1:8989;
     }

    location /api/home {
        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_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_redirect off;
        proxy_pass http://127.0.0.1:10009/api/home;
    }



伍先生
  • 职业: 程序员,产品
  • 码龄: 5.2
  • 技能: PHP Go 前端
  • 微信: JwCode
  • 公众号/小程序: 渐悟分享