server {
root /data/mobile_games/jssk;
index index.html index.htm;
server_name j.zqgame.com;
access_log /var/log/nginx/j.zqgame.com-access.log;
error_log /var/log/nginx/j.zqgame.com-error.log;
location = / {
if ($http_user_agent ~* '(iPhone|iPod)') {
set $iphone_request '1';
set $iphone_path_prefix '/iphone';
}
if ($http_user_agent ~* '(iPad)') {
set $ipad_request '1';
set $ipad_path_prefix '/ipad';
}
if ($http_user_agent ~* '(Android)') {
set $android_request '1';
set $android_path_prefix '/android';
}
if ($uri ~ ^/iphone.*$) {
set $iphone_path_prefix '';
}
#if ($uri ~ '(p_w_picpaths|stylesheets|javascripts|\.css|\.js|\.ico|\.gif|\.jpg|\.png)') {
# set $iphone_path_prefix '';
# set ipad_path_prefix '';
#}
if ($iphone_request = '1') {
rewrite (.*) $iphone_path_prefix$1;
}
if ($ipad_request = '1') {
rewrite (.*) $ipad_path_prefix$1;
}
if ($android_request = '1') {
rewrite (.*) $android_path_prefix$1;
}
}
location = ^/iphone/(.*)$ {
alias /data/mobile_games/jssk/iphone/$1;
}
}