debian下根据手机类型适配适当页面
本文是参考如下2篇文章,debian下在nginx server level根据用户手机支持的协议(xhtml、wml、html)、屏幕分辨率等信息来将用户请求转发到相应站点的实现。手机支持的协议、分辨率、型号等是根据Useragent查询wurfl得到的。本文只是基于实现的目的,如果要实际应用可能还需要很多改进。
参考:http://www.28lines.com/?p=11
Uwsgi配置参考:https://library.linode.com/web-servers/nginx/python-uwsgi/debian-5-lenny
一、Nginx处理流程图:
二、本案需要使用如下第三方模块重新编译nginx:,各模块可以到nginx官方网站下载。
1 Upstream Keepalive– Provides keep-alive connections to Memcached upstreams.
2 Lua– Embed the power of Lua into Nginx.
3 Set Hash– Set a variable to a variety of hash functions (upper/lowercase), including MD5.
4 uWSGI– Allows Nginx to interact with uWSGI processes.
lai@debian:~/ua-detect-nignx/nginx# ls -l debian/modules/
total 32
drwxr-xr-x 6 root root 4096 2011-05-03 14:04 chaoslawful-lua-nginx-module
drwxr-xr-x 9 root root 4096 2011-04-16 16:19 nginx-development-kit
drwxr-xr-x 6 root root 4096 2011-04-16 16:19 nginx-echo
drwxr-xr-x 4 root root 4096 2011-04-16 16:19 nginx-http-push
drwxr-xr-x 2 root root 4096 2011-04-16 16:19 nginx-upstream-fair
drwxr-xr-x 3 root root 4096 2011-04-30 13:52 ngx_http_upstream_keepalive
drwxr-xr-x 2 root root 4096 2011-04-30 13:52 simpl-ngx_http_set_hash
-rw-r--r-- 1 root root 696 2011-03-22 11:13 versions
Nginx编译选选:
lai@debian:~/ua-detect-nignx/nginx# vi debian/rules
111 config.status.extras: config.env.extras config.sub config.guess
112 cd $(BUILDDIR_extras) && ./configure /
113 --conf-path=/etc/nginx/nginx.conf /
114 --error-log-path=/var/log/nginx/error.log /
115 --http-client-body-temp-path=/var/lib/nginx/body /
116 --http-fastcgi-temp-path=/var/lib/ngin