请问反代的NGINX绑定多域名如何跳转到主域名?【已解决】
本帖最后由 formroot 于 2018-7-15 20:07 编辑NGINX是反代的,绑定了a.com b.com c.com d.com 想不管输入哪个地址全部跳转到a.com 试了return 301rewrite "^/(.*)$" 这些都不行,都提示重定向太多。
该怎么写呢?谢谢
[*]server {
[*] listen 80;
[*] server_name a.com b.com c.com d.com;
[*] index index.html index.htm index.php;
[*] access_log off;
[*] location / {
[*] proxy_set_header X-Real-IP $remote_addr;
[*] proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
[*] proxy_set_header Referer http://a.com;
[*] proxy_set_header Host $host;
[*] proxy_set_header Cookie $http_cookie;
[*] proxy_pass http://127.0.0.1;
[*]复制代码
static/image/smiley/yct/014.gif
dalao 人呢 dalao 人呢
static/image/smiley/yct/002.gif
[*]if ($host != "a.com") {
[*] return 301 http://a.com$request_uri;
[*]}复制代码
dvbhack 发表于 2018-7-15 20:02
static/image/smiley/yct/011.gif
谢谢!!!
页:
[1]