XL-Liang

Nginx配置如下:

server
        {
                listen       8080;
                server_name www.xxx.com;
                index index.html index.htm index.php;
                root  /home/wwwroot;
                location / {
                    resolver        222.166.225.132;
                    proxy_pass      $scheme://$http_host$request_uri;
                    proxy_buffers   256 4k;

                }
                access_log off;
        }

注意项:

1. 不能有hostname

2. 必须有resolver, 即dns,即上面的x.x.x.x,换成当前机器的DNS服务器ip即可(查看dns方法 cat /etc/resolv.conf 代理使用)

3 . $http_host和$request_uri是nginx系统变量,不要想着替换他们,保持原样就OK。

然后在浏览器中配置代理就可以了。

分类:

技术点:

相关文章:

  • 2021-05-12
  • 2021-12-15
  • 2021-07-09
  • 2022-01-07
  • 2021-08-28
  • 2021-06-26
  • 2022-01-01
  • 2022-01-07
猜你喜欢
  • 2021-06-15
  • 2022-01-05
  • 2019-07-15
  • 2022-01-15
  • 2021-11-18
  • 2022-01-22
  • 2021-06-03
相关资源
相似解决方案