nginx反向代理镜像网站做小偷站

我们可以通过Nginx的反向代理,来实现山寨或克隆一个网站。

比做小偷站实现起来更简单,因为不用任何网站程序,只需配置Nginx的反向代理即可。

[plain]  view plain  copy
  1. upstream www_cqclub_com {  
  2.     server  115.238.101.200:80;  
  3. }  
  4. server{  
  5.     listen 80;  
  6.     server_name www.cqclub.com;  
  7.     proxy_set_header Host www.22.cn;  
  8.     proxy_set_header x-forwarded-for  $remote_addr;  
  9.     location /{  
  10.         proxy_pass http://www_cqclub_com;  
  11.     }  
  12. }  

并且可以使用第三方模块HttpSubModule进行关键词替换,可以将对方网站的域名,广告等替换成自己的。

插件地址: http://wiki.nginx.org/HttpSubsModule

[plain]  view plain  copy
  1. location / {  
  2.     subs_filter_types text/html text/css text/xml;  
  3.     subs_filter st(\d*).example.com $1.example.com ir;  
  4.     subs_filter a.example.com s.example.com;  
  5. }  

当然我们也可以在nginx中开启缓存,这样就不需要每次都向源网站发起请求了。

你可能感兴趣的:(系统运维)