#教程#最简单的Nginx反代网站教程

作者: MJJ 分类: 精品教程 发布时间: 2019-01-29 19:48

最简单的Nginx反代网站教程

如果你是Debian/Ubuntu的话请:

apt-get install nginx

CentOS

yum install nginx

然后,找到你的Nginx配置文件添加虚拟机

server    {
        listen          80;
        server_name     bsc.com;#你的网站
        location / {
                proxy_set_header Accept-Encoding "";
                proxy_pass             http://abc.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

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注