请问,可以实现一个公网ip多台内部服务器吗?
[i=s] 本帖最后由 zerone 于 2012-11-15 15:48 编辑 [/i]实际环境是这样的:4台服务器,一个WDLINUX做公司网站,一个CLEAROS做防火墙,另外有两台机器做ALFRESCO文档管理及CRM。现在想通过域名访问全部服务器,比如[url=http://WWW.ABC.COM]WWW.ABC.COM[/url]、DOC.ABC.COM、CRM.ABC.COM,在网上找到 [url=http://www.blogguy.cn/index.php?action=show&id=505&page=1][b][color=#ff0000]手动DNS解析配合域名使用[/color][/b][/url],原理是在内部做了一个URL的转向,将访问DOC.ABC.COM的请求转到了内部另外一台服务器上。
我试着 在WDLINUX上新建DOC.ABC.COM,然后着修改了WWW/WDLINUX/APACHE/CONF/VHOST/DOC....CONF,但是不起做用。
也在WDLINUX中设置的DOC.ABC.COM中设置过多IP,也不行。
请问要如何实现。 [i=s] 本帖最后由 zerone 于 2012-11-15 16:27 编辑 [/i]
搜索了一下,是apache反向代理的功能,本论坛上有NGINX下的[url=http://www.wdlinux.cn/bbs/viewthread.php?tid=3353&highlight=%B7%B4%CF%F2%B4%FA%C0%ED]处理方法[/url],请教在在APACHE下如何实现。
[align=left][color=#ff0ff]可以实现一个公网IP。发布多个内网机器的网站了[/color][/align] ProxyRequests Off
ProxyPass / [url]http://127.0.0.1:9000/[/url]
ProxyPassReverse / [url]http://127.0.0.1:9000/[/url]
要在再编译下apache,加上proxy模块,默认没加上的 [i=s] 本帖最后由 zerone 于 2012-11-15 22:20 编辑 [/i]
谢谢ADMIN
我改了之后,访问DOC.ABC.COM出现403错误
Forbidden
You don't have permission to access /share on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
我的步骤
1、下载:apache2.2.2
cd /usr/local/src/
wget [url=http://archive.apache.org/dist/httpd/httpd-2.2.2.tar.gz]http://archive.apache.org/dist/httpd/httpd-2.2.2.tar.gz[/url]
chmod +x httpd-2.2.2.tar.gz
tar -zxvf httpd-2.2.2.tar.gz
2.单独编译mod_proxy模块
cd httpd-2.2.2/modules/proxy
/www/wdlinux/apache/bin/apxs -c -i -a mod_proxy.c proxy_util.c
/www/wdlinux/apache/bin/apachectl restart
/www/wdlinux/apache/bin/httpd -M #是否mod_proxy被加载
3.添加反向代理
vi /www/wdlinux/apache/conf/vhost/doc.abc.com.conf
ProxyRequests Off
ProxyPass / [url=http://192.168.0.10/]http://192.168.0.10/[/url]
ProxyPassReverse / [url=http://192.168.0.10/]http://192.168.0.10/[/url] 看下主机目录是什么权限 应该是proxy依赖的模块没有加载,需要重新编译。
问题出现了,编译时 mkdir /usr/local/apache2 ,不是WDOS的/www/wdlinux/apache,这要怎么办?
# ./configure --enable-so --enable-mods-shared="proxy proxy_http proxy_ftp proxy_connect headers"
$ make
# make install 重新安装了一个新的WDOS,直接重新编译APACHE,这回可以了。
另外,要问一下,如何重新安装APACHE,原来那个APACHE完成错乱了,已经不能使用了。 重新编译安装就可以 [i=s] 本帖最后由 zerone 于 2012-11-19 10:39 编辑 [/i]
最后总结一下,做个记录。
1.新安装WDOS
2.重新编译APACHE
wget [url=http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.22.tar.bz2]http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.22.tar.bz2[/url]
tar jxvf httpd-2.2.22.tar.bz2
cd httpd-2.2.22
./configure --prefix=/www/wdlinux/httpd-2.2.22 --enable-rewrite --disable-userdir --enable-so --enable-expires --enable-headers
make && make install
service httpd restart
3.增加doc.abc.com网站后编辑该网站配置文件
vim /www/wdlinux/apache/conf/vhost/doc.abc.com.conf
ProxyRequests Off
ProxyPass / [url]http://127.0.0.1:9000/[/url]
ProxyPassReverse / [url]http://127.0.0.1:9000[/url]
service httpd restart [i=s] 本帖最后由 zerone 于 2012-11-19 10:43 编辑 [/i]
就是在编译的时候,如果加 --enable-ssl --enable-deflate,就会出错,大概是缺少一个LIB,因为我用不到,所以就没理了.
最后感谢一下,WDLINUX 是一个非常好用的系统,难得的是FREE,谢谢。 [b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=15848&ptid=4088]9#[/url] [i]zerone[/i] [/b]
这个编译,没加proxy模块吧? [b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=15849&ptid=4088]10#[/url] [i]zerone[/i] [/b]
那看是哪个LIB,安装上就应该可以了
多多支持 [b]回复 [url=http://www.wdlinux.cn/bbs/redirect.php?goto=findpost&pid=15850&ptid=4088]11#[/url] [i]admin[/i]
[/b]
HOHO,COPYr的,忘记加了
[p=30, 2, left]./configure--prefix=/www/wdlinux/httpd-2.2.22 --enable-rewrite --disable-userdir --enable-so--enable-expires --enable-headers --enable-proxy[/p]
页:
[1]