我知道这个问题是asked before on SO,但我无法在我的服务器上复制它。将网址映射到子网域(NGINX)
我想要做的是,当用户去medicine.example.com
,子域应映射到example.com/sites/medicine
。所以用户看到的网址是medicine.example.com
。 index.php通过PHP被剥离。
以下代码给我一个502 bad gateway
错误。
server {
listen 80;
listen 443 ssl;
server_name medicine.example.com;
location/{
rewrite ^([^.]*[^/])$ $1/ permanent;
proxy_pass_header Set-Cookie;
proxy_pass https://example.com/sites$request_uri;
}
}
理想地,该解决方案将是一个通配符/正则表达式为基础的,使得不止medicine.example.com
可以被映射。思考?
简单地说'https://example.com/sites/medicine/$uri;'的'proxy_pass'值是否可以工作(不需要重写)?顺便说一句,你在看重定向还是真的代理? – 2013-03-11 14:48:27
@Jack谢谢,不行不行。 '$ request_uri'与'$ uri'变量来自哪里呢?我从来没有真正明白这一点? – 2013-03-11 14:48:52
我**不要**想重定向的网址。我想保留它,'medicine.example.com'。顺便说一句,我不知道代理是什么。 – 2013-03-11 15:07:41