?????Щnginx??????????
???????????? ???????[ 2013/4/2 13:46:28 ] ????????
????nginx.conf ???y???
???user www www;
???? Nginx ???е????????
worker_processes 8; #[ debug | info | notice | warn | error | crit ]
error_log /data1/logs/nginx_error.log crit; pid
/usr/local/webserver/nginx/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
??? nginx ???????????????????????????????????????(ulimit
-n) nginx ??????????????? nginx ??????????????????????????? ulimit -n???????????
# use [ kqueue | rtsig | epoll | /dev/poll | select | poll ];
events use epoll; ?ο???????
worker_connections 65535; ??????????????(??????=?????? x ??????) #?趨 http ??????
http include
mime.types; ?????????????????????
default_type application/octet-stream; #??????????
#charset gb2312; ??????
server_names_hash_bucket_size 128; #??????????? hash ???С
client_header_buffer_size 32k; ????????С????
large_client_header_buffers 4 32k; ?趨????
client_max_body_size 8m; ?趨????
sendfile on; #?????Ч?????????
tcp_nopush
on; ???????????
tcp_nodelay on; ???????????
keepalive_timeout 60; ??????
#FastCGI ?????????????????--????????????????????.?й? fastCGI ??
????????????:http://www.fastcgi.com
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k; #С????????С
gzip_buffers
4 16k; #?????????
gzip_http_version 1.0;
#????汾(??? 1.1?????? squid2.5 ??? 1.0
gzip_comp_level 2; ??????
gzip_types
text/plain application/x-javascript text/css application/xml;
?????????????????? text/html ???????治????д??????д?????????
???????????????????? warn
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m; server listen 80;
server_name www.opendoc.com.cn
index index.html index.htm index.php;
root /data0/htdocs/opendoc;
location ~ .*.(php|php5)?$ #fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf; #????????
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ expires 30d; #?? JS CSS ????
location ~ .*.(js|css)?$ expires 1h; #????趨
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for';
#???????
access_log /data1/logs/access.log access;
}
????nginx?ж????????豸????????
?????????????
???????????????????ж????????php?? $_SERVER['User-Agent']
php
function is_mobile(){
// returns true if one of the specified mobile browsers is detected
$regex_match="/(nokia|iphone|android|motorola|^mot-|softbank|foma|docomo
??|kddi|up.browser|up.link|";
$regex_match.="htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos
??|techfaith|palmsource|";
$regex_match.="blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam-|s[cg]h|^lge|ericsson
??|philips|sagem|wellcom|bunjalloo|maui|";
$regex_match.="symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte-
??|longcos|pantech|gionee|^sie-|portalmmm|";
$regex_match.="jigs browser|hiptop|^ucweb|^benq|haier|^lct|operas*mobi
??|opera*mini|320x320|240x320|176x220";
$regex_match.=")/i";
return isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']) or preg_match($regex_match??strtolower($_SERVER['HTTP_USER_AGENT']));
}
/*
allow the user a way to force either the full or mobile versions of the site - use a GET parameter on requests:
include likes to both versions of the site w/ the special force mode parameters?? 'mobile' and 'full':
View Mobile Sitea>
View Full Sitea>
Always check for 'mobile' or 'full' parameters before accounting for any User-Agent conditions:
*/
if ($_GET['mobile']) {
$is_mobile = true;
}
if ($_GET['full']) {
$is_mobile = false;
}
if($is_mobile) {
//it's a mobile browser?? do something
header("Location: http://wap.baidu.com");
} else {
//it's not a mobile browser?? do something else
header("Location: http://www.baidu.com");
// or instead of a redirect?? simply build html below
}
?>
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11