WDlinux官方论坛's Archiver

besthome 发表于 2019-4-28 23:04

wdcp中利用apache作反向代理

首先这个贴子就非常好:
https://www.wdlinux.cn/bbs/thread-58866-1-1.html但是很奇怪,反向代理baidu可以,其它网站或者ip,以及ip:端口的,总是不成功。
因此,找了这个方法:在apache的vhost文件中,找到相应的网站.vhost文件

编辑下:

[code]<VirtualHost *:88>
DocumentRoot /www/web/xxxx_com/public_html
ServerName xxxx.com
ServerAlias www.xxxx.com
ErrorDocument 400 /errpage/400.html
ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html
ErrorDocument 503 /errpage/503.html
</VirtualHost>
<Directory /www/web/xxxx_com>
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
</Directory>
        # 开始-apache反向代理
        ProxyRequests Off
        #apache的监听其他端口
        <proxy http://114.114.114.114:8080/>
          AllowOverride None
          Order Deny,Allow
          Allow from all
        </proxy>
       
        ProxyPass / http://114.114.114.114:8080/
        ProxyPassReverse / http://114.114.114.114:8080/
        # 结束-apache反向代理[/code]


发现新版本已经有反向代理功能,需要专业版本启用,这么倒腾管理员不要见怪。

besthome 发表于 2019-4-29 22:38

上面的方法,有个问题,如果多个反向代理时,总是指向一个网站,也没找到原因在哪,管理员或者其他兄弟有知道的,敬请指点。
后来试了试,直接利用nginx来作反向代理
在ngnix的vhost中,编辑对应的配置文件[code]location /{
    proxy_set_header Host $host:$server_port;
    proxy_pass http://ip:端口/;
}[/code]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.