I'd like to make PC and mobile devices load different index's files.
So, before the nginx main "location", I tried creating an "if" like this:
# START MOBILE
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino") {
location / {
try_files /my/dir/here/index-mobile.html $uri $uri/ /index.php ;
}
}
Howerver, I get "nginx: [emerg] "location" directive is not allowed here". Any ideas about how to make PC's show up index.html and make device browsers show up index-mobile.html?