尊龙凯时人生就是搏

NginxÔõÑùʵÏÖ»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖÃ

NginxÔõÑùʵÏÖ»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖà £¬ÐèÒªÏêϸ´úÂëʾÀý

NginxÊÇÒ»¿î¸ßÐÔÄܵÄHTTPºÍ·´ÏòÊðÀíЧÀÍÆ÷ £¬ÌṩÁËÎÞаµÄÉèÖÃÑ¡ÏîÀ´ÊµÏÖ»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖá£ÔÚ±¾ÆªÎÄÕÂÖÐ £¬ÎÒÃǽ«ÏêϸÏÈÈÝÔõÑùÉèÖÃNginxÀ´ÊµÏÖ»ùÓÚÓòÃûµÄÐéÄâÖ÷»ú £¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£

Ê×ÏÈ £¬ÎÒÃÇÐèÒªÔÚNginxµÄÉèÖÃÎļþÖÐÌí¼ÓÐéÄâÖ÷»úµÄÉèÖÿé¡£ÔÚUbuntuϵͳÉÏ £¬Ä¬ÈϵÄÉèÖÃÎļþ·¾¶Îª/etc/nginx/nginx.conf¡£ÇëʹÓÃÎı¾±à¼­Æ÷·­¿ª¸ÃÎļþ £¬²¢ÏòÆäÖÐÌí¼ÓÒÔÏ´úÂ룺

http {
    server {
        listen 80;
        server_name example.com;
        root /var/www/example.com/html;
        index index.html;
    }
    
    server {
        listen 80;
        server_name example.org;
        root /var/www/example.org/html;
        index index.html;
    }
    
    # Ìí¼Ó¸ü¶àµÄÐéÄâÖ÷»úÉèÖÿé...
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÊö´úÂëÖÐ £¬ÎÒÃǽç˵ÁËÁ½¸öÐéÄâÖ÷»ú£ºexample.comºÍexample.org¡£Ã¿¸öÐéÄâÖ÷»úÉèÖÿé°üÀ¨ÁËÒÔϼ¸¸öÒªº¦ÉèÖÃÏ

listen£ºÖ¸¶¨ÐéÄâÖ÷»ú¼àÌýµÄ¶Ë¿ÚºÅ £¬ÕâÀïÎÒÃÇʹÓÃÁË80¶Ë¿Ú¡£

server_name£ºÖ¸¶¨ÐéÄâÖ÷»ú¶ÔÓ¦µÄÓòÃû»òIPµØµã¡£ÔÚÉÏÊöʾÀýÖÐ £¬ÎÒÃÇ»®·ÖʹÓÃÁËexample.comºÍexample.org¡£

root£ºÖ¸¶¨ÐéÄâÖ÷»úµÄ¸ùĿ¼¡£ÕâÀïÎÒÃǼÙÉèÿ¸öÐéÄâÖ÷»úµÄÍøÒ³Îļþ¶¼´æ·ÅÔÚ²î±ðµÄĿ¼Ï¡£

index£ºÖ¸¶¨ÐéÄâÖ÷»úµÄĬÈÏÊ×Ò³Îļþ¡£

½ÓÏÂÀ´ £¬ÎÒÃÇÐèҪȷ±£ÐéÄâÖ÷»úµÄÍøÒ³ÎļþĿ¼±£´æ £¬²¢ÇÒ¾ßÓÐ׼ȷµÄÎļþȨÏÞ¡£ÔÚÉÏÊöʾÀýÖÐ £¬ÎÒÃǼÙÉèexample.comµÄÍøÒ³ÎļþĿ¼Ϊ/var/www/example.com/html £¬example.orgµÄÍøÒ³ÎļþĿ¼Ϊ/var/www/example.org/html¡£Çëƾ֤ÏÖÕæÏàÐν¨ÉèÕâЩĿ¼ £¬²¢È·±£NginxÓлá¼ûȨÏÞ¡£

Íê³ÉÉÏÊöÉèÖÃºó £¬ÉúÑIJ¢Í˳öNginxµÄÉèÖÃÎļþ¡£È»ºó £¬Ê¹ÓÃÒÔÏÂÏÂÁîÖØмÓÔØNginxÉèÖÃÎļþ£º

sudo nginx -s reload

µÇ¼ºó¸´ÖÆ

ÏÖÔÚ £¬ÎÒÃÇÒѾ­Íê³ÉÁË»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖᣵ±Óû§Í¨¹ýä¯ÀÀÆ÷»á¼ûexample.com»òexample.orgʱ £¬Nginx»áƾ֤ÇëÇóµÄÓòÃûÀ´Ñ¡Ôñ¶ÔÓ¦µÄÐéÄâÖ÷»ú¾ÙÐд¦Àí¡£

ÈôÊÇÄãÓиü¶àµÄÓòÃûÐèÒªÉèÖÃÐéÄâÖ÷»ú £¬Çëƾ֤ÉÏÊöʾÀýÌí¼Ó¸ü¶àµÄÐéÄâÖ÷»úÉèÖÃ¿é £¬²¢ÏìÓ¦µØÐÞ¸Äserver_nameºÍrootÉèÖÃÏî¡£

×îºó £¬ÎÒÃÇÌṩÒÔÏÂһЩ³£ÓõÄNginxÉèÖÃÖ¸ÁîÀ´½øÒ»²½ÓÅ»¯»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖãº

access_log£ºÓÃÓÚÈ·¶¨ÊÇ·ñÌìÉú»á¼ûÈÕÖ¾ÒÔ¼°ÈÕÖ¾µÄ´æ·ÅλÖá£

error_log£ºÓÃÓÚÈ·¶¨ÊÇ·ñÌìÉú¹ýʧÈÕÖ¾ÒÔ¼°ÈÕÖ¾µÄ´æ·ÅλÖá£

location£ºÓÃÓÚ½øÒ»²½¶¨ÖÆÐéÄâÖ÷»úµÄÐÐΪ £¬ºÃ±ÈÉèÖÃURLÖØд¹æÔò»ò·´ÏòÊðÀí¡£

ͨ¹ýÎÞаµØʹÓÃÒÔÉÏÖ¸Áî £¬Äã¿ÉÒÔ¶ÔÐéÄâÖ÷»ú¾ÙÐÐÔ½·¢Ï¸ÄåµÄÉèÖúÍÓÅ»¯¡£

×ܽ᣺±¾ÎÄÏêϸÏÈÈÝÁËÔõÑùʹÓÃNginxʵÏÖ»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖà £¬²¢ÌṩÁËÏêϸµÄ´úÂëʾÀý¡£Í¨¹ýƾ֤ʾÀýÉèÖÃNginxµÄÐéÄâÖ÷»ú £¬ÎÒÃÇ¿ÉÒÔÇáËɵØΪ¶à¸öÓòÃûÍйܲî±ðµÄÍøÕ¾ÄÚÈÝ £¬Ìṩ¸üºÃµÄÓû§ÌåÑ顣ϣÍûÕâƪÎÄÕ¹ØÓÚѧϰNginxµÄͬÑâÃÇÓÐËù×ÊÖú¡£

ÒÔÉϾÍÊÇNginxÔõÑùʵÏÖ»ùÓÚÓòÃûµÄÐéÄâÖ÷»úÉèÖõÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

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

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

QR code
sitemap¡¢ÍøÕ¾µØͼ