nginx和apache反向代理 GAE 裸域绑定

Nginx 反向代理:

https://raw.github.com/gist/844774/97504b89ff50f355500334513ef6538a1e98e547/nginx.conf

apache 反向代理:

在/etc/httpd/conf/httpd.conf 里加上这两句:

ProxyPass /  http://xxxx.com/

ProxyPassReverse /  http://xxxx.com/

不能在.htaccess设定。

.htaccess 加上:

RewriteEngine On

RewriteBase /

RewriteRule ^(.*)$ http://xxxx.com/$1 [P]

V2EX.com 实现裸域绑定的方法:

http://www.v2ex.com/t/6663

将 xxx.com  绑定到一台普通的 LAMP 服务器上,然后:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

index.php:
$uri = $_SERVER['REQUEST_URI'];
header('Location: http://www.xxxx.com' . $uri);

v2ex pb2 的反向代理,用apache就比较完美,功能没问题;

如果没有在httpd.conf里面那两句,会无法登录,会自动跳到原来的网址(没有代理之前),这和用NGINX一样,无法正常登录。

可以设定用ghs.google.com 反向代理,这样就没问题了,前提是APP要绑定好域名先。

This entry was posted in 网站 and tagged , , . Bookmark the permalink.

发表评论

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

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>