×ðÁú¿­Ê±¹ÙÍøµÇ¼

Ôõô°Ñnginx»á¿´·¨Ö·ÉèÖóÉЧÀÍÆ÷ip

ÒªÔÚ nginx Öн«»á¿´·¨Ö·ÉèÖÃΪЧÀÍÆ÷ ip £¬Ç룺ÉèÖÃЧÀÍÆ÷¿é £¬ÉèÖüàÌýµØµã£¨È磺listen 192.168.1.10:80£©ÉèÖÃЧÀÍÆ÷Ãû³Æ£¨È磺server_name example.com www.example.com£© £¬»ò½«ÆäÁô¿ÕÒÔ»á¼ûЧÀÍÆ÷ ipÉúÑIJ¢ÖØмÓÔØ nginx ÒÔÓ¦Óøü¸Ä

ÔõÑùÔÚ Nginx Öн«»á¿´·¨Ö·ÉèÖÃΪЧÀÍÆ÷ IP

ÔÚ Nginx Öн«»á¿´·¨Ö·ÉèÖÃΪЧÀÍÆ÷ IP µÄ°ì·¨£º

1. ÉèÖÃЧÀÍÆ÷¿é

ÔÚ Nginx ÉèÖÃÎļþÖÐ £¬ÕÒµ½»ò½¨ÉèÒªÉèÖõÄЧÀÍÆ÷¿é¡£Ð§ÀÍÆ÷¿éͨ³£Î»ÓÚ “sites-enabled” Ŀ¼ÏµÄÉèÖÃÎļþÖС£

server {
    ...
}

µÇ¼ºó¸´ÖÆ

2. ÉèÖüàÌýµØµã

ÔÚЧÀÍÆ÷¿éÖÐ £¬Ìí¼Ó “listen” Ö¸ÁîÒÔÖ¸¶¨ Nginx ¼àÌýµÄ IP µØµãºÍ¶Ë¿Ú¡£

server {
    listen <ip-address>:<port>;
    ...
}</port></ip-address>

µÇ¼ºó¸´ÖÆ

ÆäÖÐ £¬ ÊÇЧÀÍÆ÷µÄ IP µØµã £¬ ÊÇÄúÏ£ÍûÓÃÓÚ»á¼ûÍøÕ¾µÄ¶Ë¿Ú£¨Í¨³£Îª 80£©¡£ÀýÈç £¬ÒªÈà Nginx ÔÚЧÀÍÆ÷ IP “192.168.1.10” É쵀 80 ¶Ë¿Ú¼àÌý£º

server {
    listen 192.168.1.10:80;
    ...
}

µÇ¼ºó¸´ÖÆ

3. ÉèÖÃЧÀÍÆ÷Ãû³Æ

ÔÚЧÀÍÆ÷¿éÖÐ £¬Ìí¼Ó “server_name” Ö¸ÁîÒÔÖ¸¶¨Ð§ÀÍÆ÷ÏìÓ¦µÄÓòÃû»ò IP µØµã¡£

server {
    listen <ip-address>:<port>;
    server_name example.com www.example.com;
    ...
}</port></ip-address>

µÇ¼ºó¸´ÖÆ

ÈôÊǻῴ·¨Ö·²»ÊÇÓòÃû £¬Ç뽫 “server_name” ÉèÖÃΪ¿Õ¡£

4. ÉúÑIJ¢ÖØмÓÔØ Nginx

ÉúÑÄ Nginx ÉèÖÃÎļþ²¢ÖØмÓÔØ Nginx ÒÔÓ¦Óøü¸Ä¡£

sudo systemctl reload nginx

µÇ¼ºó¸´ÖÆ

ÏÖÔÚ £¬µ±Äú»á¼ûÔÚ “listen” Ö¸ÁîÖÐÖ¸¶¨µÄ IP µØµãºÍ¶Ë¿Úʱ £¬Nginx ½«»áÏìÓ¦²¢ÏÔʾΪЧÀÍÆ÷ IP »á¼ûµÄÍøÕ¾¡£

ÒÔÉϾÍÊÇÔõô°Ñnginx»á¿´·¨Ö·ÉèÖóÉЧÀÍÆ÷ipµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ