nginx±äÁ¿ÔõôÓÃ
nginx±äÁ¿Ê¹ÓÃÒªÁì
ʲôÊÇNginx±äÁ¿£¿
Nginx±äÁ¿ÊÇ´æ´¢Ìض¨ÐÅÏ¢»òÖµµÄ¿Õ¼äռλ·û£¬ÓÃÓÚÔÚNginxÉèÖÃÖж¯Ì¬ÌìÉúÎı¾¡£
ÔõÑùʹÓÃNginx±äÁ¿£¿
ҪʹÓÃNginx±äÁ¿£¬ÇëʹÓÃÃÀÔª·ûºÅ ($) ºó¸ú±äÁ¿Ãû£º
$variable_name
µÇ¼ºó¸´ÖÆ
³£ÓÃNginx±äÁ¿£º
$arg_variable_name£º´ÓÇëÇóÖÐÌáÈ¡URL²ÎÊý
$host£ºÇëÇóµÄÖ÷»úÃû
$http_host£ºÇëÇóµÄHTTPÖ÷»úÍ·
$method£ºÇëÇóÒªÁ죨ÀýÈçGET¡¢POST£©
$remote_addr£º¿Í»§¶ËµÄIPµØµã
$request_uri£ºÇëÇóµÄURI
$server_name£ºÐ§ÀÍÆ÷Ãû³Æ
$time_local£ºÄ¿½ñЧÀÍÆ÷ʱ¼ä£¨ÍâµØʱ¼ä£©
ʹÓÃʾÀý£º
ÒÔÏÂʾÀýʹÓà $remote_addr ±äÁ¿À´¼Í¼»á¼ûÈÕÖ¾Öпͻ§¶ËµÄIPµØµã£º
access_log /var/log/nginx/access.log $remote_addr;
µÇ¼ºó¸´ÖÆ
ÆäËûʹÓó¡¾°£º
ƾ֤ÇëÇóÖ÷»úÃûÖض¨ÏòÇëÇó
Ϊ²î±ðµÄ¿Í»§¶Ë¶¨ÖÆÏìÓ¦
¼Í¼ÇëÇóÐÅÏ¢ÒÔ¾ÙÐе÷ÊÔ»òÆÊÎö
×¢ÖØ£º
È·±£±äÁ¿Ãû³Æ׼ȷÎÞÎó¡£
ÔÚÐèҪתÒåÌØÊâ×Ö·û£¨ÈçÃÀÔª·ûºÅ£©Ê±Ê¹Ó÷´Ð±¸Ü ()¡£
ÍƼöʹÓòâÊÔÇéÐÎÀ´²âÊÔ±äÁ¿Ó÷¨¡£
ÒÔÉϾÍÊÇnginx±äÁ¿ÔõôÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡