超级简单的 Nginx 反代网站教程
如果你是 Debian/Ubuntu 的话请在终端输入:
apt-get install nginx
CentOS
yum install nginx
修改配置:
然后, 找到你的 Nginx 配置文件添加虚拟机
server    {
        listen          80;
        server_name     abc.com;#你的网站
        location / {
                proxy_set_header Accept-Encoding "";
                proxy_pass             http://efg.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  'abc.com' 'efg.com';#替换其中所有的原网站链接
                sub_filter_types *;
                sub_filter_once off;
        }
    }
重启服务:
 service nginx restart
显示 OK 成功即可
版权声明:
                                    
作者:超级管理员                                    
链接:
                                    
                                      
                                        https://apecloud.ltd/article/detail.html?id=12
                                      
                                    
                                    
来源:猿码云个人技术站                                    
文章版权归作者所有,未经允许请勿转载。
THE END
                                
                                
                                      二维码
                                  
                                      打赏
                                  
                            
 
                          
共有0条评论