Running nginx as reverse proxy with Apache, rewrite problem

Dayo nginx-forum at nginx.us
Fri Mar 18 23:30:47 MSK 2011


Try:

Server {
	server_name site.com;
	listen 80;
	root /path/to/regular/content/;
	if ($http_user_agent ~* (mobile|android|blackberry|brew|htc|j2me|lg|midp|mot|netfront|nokia|obigo|openweb|opera\smini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|wap|webos|windows\sce) ) {
		rewrite ^ http://mobile.site.com$request_uri redirect;
	}
	location /xyz/ {
		...
	}
}

Server {
	server_name mobile.site.com;
	listen 80;
	root /path/to/mobile/content/;
	if ($http_user_agent !~* (mobile|android|blackberry|brew|htc|j2me|lg|midp|mot|netfront|nokia|obigo|openweb|opera\smini|palm|psp|samsung|sanyo|sch|sonyericsson|symbian|symbos|teleca|up.browser|wap|webos|windows\sce) ) {
		rewrite ^ http://site.com$request_uri redirect;
	}
	location /xyz/ {
		...
	}
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,183798,183819#msg-183819




More information about the nginx mailing list