Nginx·ºÓòÃû½âÎö¼°RewriteÖض¨ÏòÆÕͨҳÃæ¼°´ø²ÎÊýµÄÒ³Ãæ
--with-http_sub_module
Ê×ÏÈÐèÒªÔÚÓòÃû½âÎöÖÐÔö¼ÓÒ»Ìõ¼Ç¼£¬ÀýÈ磺*.it300.com µ½Ä³Ì¨·þÎñÆ÷
Ô±¾×¼±¸»»Linux·þÎñÆ÷£¬ËùÒÔÊý¾ÝǨÒÆÔÝʱÐèҪʹÓþ²Ì¬Ò³ÃæÁÙʱ´úÌæһϣ¬Ö®Ç°µÄarticle.php?id=xxx¶¼ÒªÖض¨Ïòµ½¾²Ì¬Îļþarticle/xxx.htm£¬ÏÂÃæ¿´¿´NginxÊÇÈçºÎ½øÐÐRewriteµÄ£¡
1¡¢¾²Ì¬µØÖ·Öض¨Ïòµ½´ø²ÎÊýµÄ¶¯Ì¬µØÖ·
- rewrite "^(.*)/service/(.*)\.html$" $1/service.php?sid=$2 permanent;
2¡¢´ø²ÎÊýµÄ¶¯Ì¬µØÖ·Öض¨Ïòµ½¾²Ì¬µØÖ·
- if ($query_string ~* id=(.*)) {
- set $id $1;
- rewrite "^(.*)/article.php$" $1/article/$id.htm last;
- }
3¡¢·ºÓòÃû½âÎö
server_name www.it300.com *.it300.com; server_name_in_redirect off; //´ËÏî˵Ã÷²ÎÕÕÏÂÎĽâÊÍ #ÉèÖÃĬÈÏroot set $rootdir /data/www/it300/; #Æ¥ÅäÈý¼¶ÓòÃû if ($host ~* ^([^\.]+)\.([^\.]+)\.([^\.]+)\.([^\.]+)$) { set $rootdir /data/www/it300/$2/$1; #Èý¼¶ÓòÃûÖÐÓзÃÎÊÖ¸¶¨µÄĿ¼ÔòÖض¨Ïòµ½ÏàÓ¦µÄ¶þ¼¶ÓòÃûÏ rewrite "^.+upload/?(.*)$" http://upload.it300.com/$1 permanent; rewrite "^.+ijc/?(.*)$" http://ijc.it300.com/$1 permanent; break; } #Æ¥Åä¶þ¼¶ÓòÃû if ($host ~* ^([^\.]+)\.([^\.]+)\.([^\.]+)$) { set $subdomain $1; } #ÉèÖÃwwwʱroot if ($subdomain ~* ^www$) { set $rootdir /data/www/it300/; #¶þ¼¶ÓòÃûÖÐÓзÃÎÊÖ¸¶¨µÄĿ¼ÔòÖض¨Ïòµ½ÏàÓ¦µÄ¶þ¼¶ÓòÃûÏÂ,×¢Ò⣬ÕâÀïҪʹÓÃlast rewrite "^.+upload/?(.*)$" upload/$1 last; rewrite "^.+ijc/?(.*)$" ijc/$1 last; break; } #ÉèÖ÷Çwww¶þ¼¶ÓòÃûʱroot if ($subdomain !~* ^www$) { set $rootdir /data/www/it300/$subdomain; #¶þ¼¶ÓòÃûÖÐÓзÃÎÊÖ¸¶¨µÄĿ¼ÔòÖض¨Ïòµ½ÏàÓ¦µÄ¶þ¼¶ÓòÃûÏ rewrite "^.+upload/?(.*)$" http://upload.i.com/$1 permanent; rewrite "^.+ijc/?(.*)$" http://ijc.w3cgroup.com/$1 permanent; break; } #Ó¦ÓÃroot root $rootdir; index index.php index.html; error_page 404 http://$host/; location ~ .*\.(php|php5)?($|/) { fastcgi_param SCRIPT_FILENAME /data/www/it300/$subdomain/$fastcgi_script_name; fastcgi_split_path_info ^(.+.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; }
×¢Ò⣺if () {} Ö®¼äÐèÒª¿Õ¸ñ£¬·ñÔòNginx.conf»á±¨unknow directive ´íÎó!
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ