Linux Apache 反向代理很奇怪的问题

yasinjan · October 12, 2013 · Last by yasinjan replied at October 12, 2013 · 3882 hits

我装 OpenERP 到 Amacon EC2 Ubuntu 12.04. (是 python).

然后用 服务器 ip:8069 , domain-one:8069 都可以访问网站。我这个服务器上有几个域名用 virtualhost 的。 现在想用 domain-two.com 做为这个应用的域名。然后在/etc/apache2/sites-enabled/openerp 里设置了这样:

ServerName domain-two.com ProxyRequests Off ProxyPreserveHost On Order allow,deny Allow from all

ProxyPass / http://localhost:8069/ ProxyPassReverse / http://localhost:8069/ ProxyPreserveHost On #ProxyErrorOverride Off SetEnv proxy-nokeepalive 1

然后用 domain-two.com,死活访问不了。 有趣的是 自己电脑的 /etc/hosts 里加入这个:

服务器 ip domain-two.com

然后就可以访问。

大家知道是什么原因吗?

ServerName 为域名时,apache 貌似会解析得到 ip,再绑定端口到对应的 ip 上面。

如果 dns 没有注册此域名,应该就需要在 hosts 里面手动绑定 ip

http://httpd.apache.org/docs/2.2/mod/core.html#servername http://httpd.apache.org/docs/2.2/dns-caveats.html

谢谢了。居然在域名提供商里的 NameServer 里换了 4 个 dns 的地址排序,问题就解决了。

You need to Sign in before reply, if you don't have an account, please Sign up first.