-
-
Save ttfcfc/724e27da0c969a5ae7b5e8f238ab373e to your computer and use it in GitHub Desktop.
nginx根据user-agent手机端跳转,nginx rewrite详见:http://seanlook.com/2015/05/17/nginx-location-rewrite/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location = / { | |
if ($http_user_agent ~* "(Android|iPhone|iPod|Symbian|BlackBerry|Windows Phone|Mobile|J2ME)") { | |
rewrite ^ http://m.uxin.com permanent; | |
} | |
#htpasswd密码生成可用在线工具http://tool.oschina.net/htpasswd,加密方式选Crypt | |
auth_basic_user_file /data/soft/nginx/conf/htpasswd; | |
auth_basic "please input passwd, or contact YANGL"; | |
proxy_pass http://newwww; | |
proxy_http_version 1.1; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_set_header Remote-Addr $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment