lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
¹ØÓÚnginx·ÀµÁÁ´µÄ·½·¨ÍøÉÏÓкܶà½Ì³Ì£¬¶¼¿ÉÒÔÓ㬵«ÊÇÎÒ·¢Ïֺܶà½Ì³Ì²¢²»ÍêÕû£¬Ëù×öµÄ·ÀµÁÁ´²¢²»ÊÇÕæÕýµÄ³¹µ×µÄ·ÀµÁÁ´£¡
Ò»°ã£¬ÎÒÃÇ×öºÃ·ÀµÁÁ´Ö®ºóÆäËûÍøÕ¾µÁÁ´µÄ±¾Õ¾Í¼Æ¬¾Í»áÈ«²¿Ê§Ð§ÎÞ·¨ÏÔʾ£¬µ«ÊÇÄúÈç¹ûͨ¹ýä¯ÀÀÆ÷Ö±½ÓÊäÈëͼƬµØÖ·£¬ÈÔÈ»»áÏÔʾͼƬ£¬ÈÔÈ»¿ÉÒÔÓÒ¼üͼƬÁí´æΪÏÂÔØÎļþ£¡
ÒÀÈ»¿ÉÒÔÏÂÔØ£¿ÕâÑù¾Í²»Êdz¹µ×µÄ·ÀµÁÁË£¡ÄÇô£¬nginxÓ¦¸ÃÔõôÑù³¹µ×µØʵÏÖÕæÕýÒâÒåÉϵķÀµÁÁ´ÄØ£¿
Ê×ÏÈ£¬ÎÒÃÇÀ´¿´ÏÂnginxÈçºÎÉèÖ÷ÀµÁÁ´
Èç¹ûÄúʹÓõÄÊÇĬÈÏÕ¾µã£¬Ò²¾ÍÊÇ˵£¬ÄúµÄÕ¾µã¿ÉÒÔÖ±½ÓÊäÈë·þÎñÆ÷IP·ÃÎʵģ¬Ê¹ÓÃrootµÇ¼£¬ÐÞ¸Ä /usr/local/nginx/conf/nginx.conf Õâ¸öÅäÖÃÎļþ¡£
Èç¹ûÄúн¨ÁËÕ¾µã£¬ÄÇôÐÞ¸Ä/usr/local/nginx/conf/vhost/ÄãµÄÓòÃû.conf Õâ¸öÅäÖÃÎļþ£¬ÕÒµ½£º
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; }
°ÑÕâÒ»¶Îɾµô£¬Ð޸ijɣº
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { valid_referers none blocked *.it300.com it300.com; if ($invalid_referer) { rewrite ^/ http://www.it300.com/static/images/404.jpg; #return 404; } expires 30d; }µÚÒ»ÐУº location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
ÆäÖС°gif|jpg|jpeg|png|bmp|swf¡±ÉèÖ÷ÀµÁÁ´ÎļþÀàÐÍ£¬×ÔÐÐÐ޸ģ¬Ã¿¸öºó׺Óá°|¡±·ûºÅ·Ö¿ª£¡
µÚÈýÐУºvalid_referers none blocked *.it300.com it300.com;
¾ÍÊÇ°×Ãûµ¥£¬ÔÊÐíÎļþÁ´³öµÄÓòÃû°×Ãûµ¥£¬×ÔÐÐÐ޸ijÉÄúµÄÓòÃû£¡*.it300.comÕâ¸öÖ¸µÄÊÇ×ÓÓòÃû£¬ÓòÃûÓëÓòÃûÖ®¼äʹÓÿոñ¸ô¿ª£¡
µÚÎåÐУºrewrite ^/ http://www.it300.com/static/images/404.jpg;
Õâ¸öͼƬÊǵÁÁ´·µ»ØµÄͼƬ£¬Ò²¾ÍÊÇÌæ»»µÁÁ´ÍøÕ¾ËùÓеÁÁ´µÄͼƬ¡£Õâ¸öͼƬҪ·ÅÔÚûÓÐÉèÖ÷ÀµÁÁ´µÄÍøÕ¾ÉÏ£¬ÒòΪ·ÀµÁÁ´µÄ×÷Óã¬Õâ¸öͼƬÈç¹ûÒ²·ÅÔÚ·ÀµÁÁ´ÍøÕ¾ÉϾͻᱻµ±×÷·ÀµÁÁ´ÏÔʾ²»³öÀ´ÁË£¬µÁÁ´ÕßµÄÍøÕ¾ËùµÁÁ´Í¼Æ¬»áÏÔʾX·ûºÅ¡£
ÕâÑùÉèÖò¶à¾Í¿ÉÒÔÆðµ½·ÀµÁÁ´×÷ÓÃÁË£¬ÉÏÃæ˵ÁË£¬ÕâÑù²¢²»Êdz¹µ×µØʵÏÖÕæÕýÒâÒåÉϵķÀµÁÁ´£¡
ÎÒÃÇÀ´¿´µÚÈýÐУºvalid_referers none blocked *.it300.com it300.com;
valid_referers Àï¶àÁË¡°none blocked¡±
ÎÒÃÇ°Ñ¡°none blocked¡±É¾µô£¬¸Ä³É
valid_referers *.it300.com it300.com;
nginx³¹µ×µØʵÏÖÕæÕýÒâÒåÉϵķÀµÁÁ´ÍêÕûµÄ´úÂëÓ¦¸ÃÊÇÕâÑùµÄ£º
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { valid_referers *.it300.com it300.com; if ($invalid_referer) { rewrite ^/ http://www.it300.com/static/images/404.jpg; #return 404; } expires 30d; }
ÕâÑùÄúÔÚä¯ÀÀÆ÷Ö±½ÓÊäÈëͼƬµØÖ·¾Í²»»áÔÙÏÔʾͼƬ³öÀ´ÁË£¬Ò²²»¿ÉÄÜ»áÔÙÓÒ¼üÁí´æʲôµÄ¡£
µÚÎåÐУºrewrite ^/ http://www.it300.com/static/images/404.jpg;
Õâ¸öÊǸøͼƬ·ÀµÁÁ´ÉèÖõķÀµÁÁ´·µ»ØͼƬ£¬Èç¹ûÎÒÃÇÊÇÎļþÐèÒª·ÀµÁÁ´ÏÂÔØ£¬°ÑµÚÎåÐУº
rewrite ^/ http://www.it300.com/static/images/404.jpg;
¸Ä³ÉÒ»¸öÁ´½Ó£¬¿ÉÒÔÊÇÄúÖ÷Õ¾µÄÁ´½Ó£¬±ÈÈç°ÑµÚÎåÐиijɺƺ£´úÂëÖ÷Ò³£º
rewrite ^/ http://www.it300.com;
ÕâÑù£¬µ±±ðÈËÊäÈëÎļþÏÂÔصØÖ·£¬ÓÉÓÚ·ÀµÁÁ´ÏÂÔصÄ×÷ÓþͻáÌøתµ½ÄúÉèÖõÄÕâ¸öÁ´½Ó£¡
×îºó£¬ÅäÖÃÎļþÉèÖÃÍê³É±ðÍü¼ÇÖØÆônginxÉúЧ£¡
ƽ»¬ÖØÆônginx£º
/etc/init.d/nginx reload
ÍƼöÐÅÏ¢
- 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µÈ
ÆÀÂÛ