ºìÁªLinuxÃÅ»§
Linux°ïÖú

Apache HTTP·þÎñÆ÷µÄʹÓÃ------µØÖ·ºÍ¶Ë¿ÚµÄ°ó¶¨(Binding)

·¢²¼Ê±¼ä:2006-08-20 21:22:12À´Ô´:ºìÁª×÷Õß:¶¡¶¡
ÅäÖÃApache¼àÌýÖ¸¶¨µÄµØÖ·ºÍ¶Ë¿Ú¡£
top
¸ÅÊö
Ïà¹ØÄ£¿é Ïà¹ØÖ¸Áî

* core
* mpm_common



*
* Listen

ApacheÆô¶¯Ê±£¬»á°ó¶¨±¾»úÉϵĵØÖ·ºÍ¶Ë¿Ú£¬È»ºóµÈ´ýÇëÇóµÄ½øÈ롣ĬÈÏÇé¿öÏ£¬Ëü»á¼àÌý±¾»úµÄËùÓеØÖ·¡£µ«ÊÇ£¬µ±ÐèÒª¼àÌýÌض¨µÄµØÖ·»ò¶Ë¿Ú»òµØÖ·Óë¶Ë¿ÚµÄ×éºÏ£¬»òÕßÐèÒª¶Ô²»Í¬µÄIPµØÖ·¡¢Ö÷»úÃû¡¢¶Ë¿Ú×÷³ö²»Í¬µÄÏìÓ¦(ÈçʹÓÃÐéÄâÖ÷»ú)ʱ£¬¾Í±ØÐëÃ÷È·Ö¸¶¨¡£

ListenÖ¸Áî¸æËß·þÎñÆ÷½ÓÖ»ÊÜÀ´×ÔÌض¨¶Ë¿Ú(»òµØÖ·+¶Ë¿ÚµÄ×éºÏ)µÄÇëÇó¡£Èç¹ûListenÖ¸Áî½öÖ¸¶¨Á˶˿ڣ¬Ôò·þÎñÆ÷»á¼àÌýËùÓеÄIPµØÖ·£»Èç¹ûÖ¸¶¨Á˵ØÖ·+¶Ë¿ÚµÄ×éºÏ£¬Ôò·þÎñÆ÷Ö»¼àÌýÀ´×Ô´ËÌض¨µØÖ·ÉÏÌض¨¶Ë¿ÚµÄÇëÇó¡£Ê¹Óöà¸öListenÖ¸Á¿ÉÒÔÖ¸¶¨ÔÚ¶à¸öµØÖ·ºÍ¶Ë¿ÚÉϽøÐмàÌý¡£

ÀýÈ磺ʹ·þÎñÆ÷ͬʱ½ÓÊÜÀ´×Զ˿Ú80ºÍ8000µÄÇëÇ󣬿ÉÒÔÕâÑùд£º

Listen 80
Listen 8000

½ÓÊÜÀ´×ÔÁ½¸öÖ¸¶¨µÄµØÖ·+¶Ë¿ÚµÄ×éºÏ£º

Listen 192.170.2.1:80
Listen 192.170.2.5:8000

IPv6µØÖ·±ØÐëÓ÷½À¨ºÅÀ¨ÆðÀ´£º

Listen [2001:db8::a00:20ff:fea7:ccea]:80
top
Õë¶ÔIPv6µÄÌØÊ⿼ÂÇ

ÓÐÔ½À´Ô½¶àµÄƽ̨¿ªÊ¼Ö§³ÖIPv6 £¬¶øAPRÔÚ´ó¶àÊýƽ̨ÉÏÒ²Ö§³ÖIPv6 £¬Ê¹ApacheÄܹ»»ñµÃIPv6Ì×½Ó×Ö£¬²¢´¦Àíͨ¹ýIPv6·¢Ë͵ÄÇëÇó¡£

Ò»¸ö¾­³£ÁîApache¹ÜÀíÔ±ÒÉ»óµÄÎÊÌâÊÇIPv6µÄÌ×½Ó×ÖÄÜ·ñͬʱ´¦ÀíIPv4ºÍIPv6µÄÁ¬½Ó¡£IPv6Ì×½Ó×ÖÔÚ´¦ÀíIPv4Á¬½ÓʱʹÓõÄÊǽ«IPv6 Ó³Éäµ½IPv4µÄµØÖ·(IPv4-mapped IPv6 addresses)£¬ÕâÑù×öÔÚ´ó¶àÊýƽ̨ÉÏĬÈÏÊÇÔÊÐíµÄ£¬¶øÔÚFreeBSD¡¢NetBSD¡¢OpenBSDÉÏ£¬ÎªÁËÅäºÏÆäϵͳȫ¾Ö²ßÂÔ£¬Ä¬ÈÏÈ´ÊǽûÖ¹µÄ¡£¼´Ê¹ÔÚÕâЩĬÈϽûÖ¹µÄƽ̨ÉÏ£¬ApacheÒ²¿ÉÒÔͨ¹ýÌØÊâµÄ±àÒëÑ¡ÏîÀ´¸Ä±äÕâÖÖÐÐΪ¡£

ÁíÒ»·½Ã棬ÔÚijЩƽ̨ÉÏ(ÈçLinuxºÍTru64)ͬʱ´¦ÀíIPv6ºÍIPv4µÄΨһ·½·¨¾ÍÊÇʹÓÃÓ³ÉäµØÖ·(mapped addresses)¡£Èç¹ûÄãÏ£ÍûApacheÒÔ×îÉÙµÄÌ×½Ó×Öͬʱ´¦ÀíIPv4ºÍIPv6µÄÁ¬½Ó£¬¾Í±ØÐëʹÓÃÓ³Éäµ½IPv4µÄIPv6µØÖ·£¬Ò²¾ÍÊDZØÐëÖ¸¶¨ --enable-v4-mapped ±àÒëÑ¡Ïî¡£

ÔÚ³ýFreeBSD¡¢NetBSD¡¢OpenBSDÒÔÍâµÄÆäËûƽ̨ÉÏ£¬--enable-v4-mapped ÊDZàÒëʱµÄĬÈÏÖµ¡£Òò´ËÄãÕýÔÚʹÓõÄApacheºÜ¿ÉÄܾÍÊÇ°´ÕÕÕâÖÖ·½Ê½±àÒëµÄ¡£

ҪʹApache½ö½öÖ»´¦ÀíIPv4Á¬½Ó£¬ÎÞÂÛÄãµÄƽ̨ÊÇʲô»òÕßAPRÊÇ·ñÖ§³Ö£¬Ö»Ðë¶ÔËùÓÐListenÖ¸Áָ¶¨IPv4µØÖ·¼´¿É£¬ÈçÏÂËùʾ£º

Listen 0.0.0.0:80
Listen 192.170.2.1:80

Èç¹ûÄãµÄƽ̨֧³Ö´ÓIPv6µ½IPv4µÄµØÖ·Ó³É䣬µ«ÊÇÄãÓÖÏ£ÍûApacheʹÓò»Í¬µÄÌ×½Ó×Ö·Ö±ð´¦ÀíIPv4ºÍIPv6µÄÁ¬½Ó(Ò²¾ÍÊǽûÓõØÖ·Ó³Éä)£¬±ØÐëÃ÷È·Ö¸¶¨ --disable-v4-mapped ±àÒëÑ¡Ïî¡£×¢Ò⣺--disable-v4-mapped ÔÚFreeBSD¡¢NetBSD¡¢OpenBSDÉÏÊÇĬÈÏÖµ¡£
top
ÔõÑùÓëÐéÄâÖ÷»úЭͬ¹¤×÷

ListenÖ¸Áî²¢²»ÊµÏÖÐéÄâÖ÷»ú£¬ËüÖ»ÊǸæËßÖ÷·þÎñÆ÷(main server)È¥¼àÌýÄÄЩµØÖ·ºÍ¶Ë¿Ú¡£Èç¹ûûÓÐÖ¸Á·þÎñÆ÷½«¶ÔËùÓÐÇëÇóÒ»ÊÓͬÈÊ£»µ«ÊÇÈç¹ûÓÐÖ¸ÁÔò·þÎñÆ÷»á¶Ô²»Í¬µÄµØÖ·ºÍ¶Ë¿Ú×÷³ö²»Í¬µÄÏìÓ¦¡£ÒªÊµÏÖÐéÄâÖ÷»ú£¬Ê×ÏȱØÐë¸æËß·þÎñÆ÷ÐèÒª¼àÌýÄÄЩµØÖ·ºÍ¶Ë¿Ú£¬È»ºóΪÿ¸öÌض¨µÄµØÖ·ºÍ¶Ë¿Ú½¨Á¢Ò»¸ö¶ÎÀ´Ö´ÐÐÌض¨µÄÏàÓ¦¡£×¢Ò⣬Èç¹û½«¶ÎÉèÖÃΪ·þÎñÆ÷ûÓмàÌýµÄµØÖ·ºÍ¶Ë¿Ú£¬Ôò´Ë¶ÎÎÞЧ¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. ¿ÕÖеÄÔÆ ÓÚ 2012-11-27 20:04:39·¢±í:

    ¶¥