我們有的網友需要用到一些較好速度的服務器給網站過度加速使用,這裏有些是使用反代方法的。如果我們只是就簡單的實現這個功能的話,可以用Nginx實現,配置起來也是比較簡單的。在這篇文章中,這裏可以用Ubuntu/Debian系統快速的配置Nginx然後實現反代網站的效果。
第一、安裝Nginx
apt-get install nginx -y
第二、配置文件
server {
listen 80;
server_name cnbanwagong.com;#你的網站
location / {
proxy_set_header Accept-Encoding "";
proxy_pass http://cnbanwagong.com/;#反代的網站
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
sub_filter 'bsc.com' 'abc.com';#替換其中所有的原網站鏈接
sub_filter_types *;
sub_filter_once off;
}
}
第三、重啓生效
service nginx restart
重啓服務器生效。