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 实现裸域绑定的方法:
将 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要绑定好域名先。