[網站克隆]nginx反向代理鏡像網站做小偷站
我們可以通過Nginx的反向代理,來實現山寨或克隆一個網站。
比做小偷站實現起來更簡單,因為不用任何網站程序,只需配置Nginx的反向代理即可。
- upstream www_cqclub_com {
- server 115.238.101.200:80;
- }
- server{
- listen 80;
- server_name www.cqclub.com;
- proxy_set_header Host www.22.cn;
- proxy_set_header x-forwarded-for $remote_addr;
- location /{
- proxy_pass http://www_cqclub_com;
- }
- }
并且可以使用第三方模塊HttpSubModule進行關鍵詞替換,可以將對方網站的域名,廣告等替換成自己的。
插件地址: http://wiki.nginx.org/HttpSubsModule
- location / {
- subs_filter_types text/html text/css text/xml;
- subs_filter st(/d*).example.com $1.example.com ir;
- subs_filter a.example.com s.example.com;
- }
當然我們也可以在nginx中開啟緩存,這樣就不需要每次都向源網站發起請求了。