nginx 学习:将域名转发到另一个域名

这样访问 http://baidu.shaochenfeng.com 时就会转发到 http://www.baidu.com
更新于: 2021-12-01 06:35:05
server{
  listen 80;
  server_name  baidu.shaochenfeng.com;
  index  index.php index.html index.htm;

  location / {
    proxy_pass  http://www.baidu.com;
    proxy_set_header Host $proxy_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}