nginxÔõÑùÉèÖÃÐéÄâÖ÷»ú
ÉèÖà nginx ÐéÄâÖ÷»úÔÊÐíÔÚÒ»¸öЧÀÍÆ÷ÉÏÍйܶà¸öÍøÕ¾£¬Ã¿¸öÍøÕ¾ÓµÓÐ×ÔÁ¦ÓòÃûºÍ¸ùĿ¼¡£ÏêϸÉèÖð취°üÀ¨£º½¨ÉèÐéÄâÖ÷»úÉèÖÃÎļþÉèÖÃЧÀÍÆ÷¿é£¬Ö¸¶¨Ð§ÀÍÆ÷¼àÌý¶Ë¿Ú¡¢ÐéÄâÖ÷»úÓòÃûºÍÎĵµ¸ùĿ¼ÆôÓÃÐéÄâÖ÷»ú£¬½«ÉèÖÃÎļþÁ´½Óµ½ÆôÓÃĿ¼ÖØмÓÔØ nginx
nginx ÐéÄâÖ÷»úµÄÉèÖÃ
ʲôÊÇÐéÄâÖ÷»ú£¿
ÐéÄâÖ÷»úÔÊÐíÄúÔÚÒ»¸öЧÀÍÆ÷ÉÏÍйܶà¸öÍøÕ¾£¬Ã¿¸öÍøÕ¾¶¼ÓÐ×Ô¼ºµÄÓòÃûºÍ¸ùĿ¼¡£
ÔõÑùÔÚ nginx ÖÐÉèÖÃÐéÄâÖ÷»ú£¿
ÔÚ nginx ÖÐÉèÖÃÐéÄâÖ÷»úÉæ¼°ÒÔÏ°취£º
1. ½¨ÉèÐéÄâÖ÷»úÉèÖÃÎļþ
ÔÚ /etc/nginx/sites-available/ Ŀ¼Öн¨ÉèÒ»¸öеÄÉèÖÃÎļþ£¬ÀýÈç yourdomain.com.conf¡£
2. ÉèÖÃЧÀÍÆ÷¿é
ÔÚÉèÖÃÎļþÖÐÌí¼ÓÒ»¸öЧÀÍÆ÷¿é£¬ÈçÏÂËùʾ£º
server { listen 80; server_name yourdomain.com www.yourdomain.com; root /var/www/yourdomain.com/public_html; # ÆäËûÉèÖÃ... }
µÇ¼ºó¸´ÖÆ
listen 80; Ö¸¶¨Ð§ÀÍÆ÷¼àÌýµÄ¶Ë¿Ú¡£
server_name ָʾÐéÄâÖ÷»úµÄÓòÃû¡£
root Ö¸¶¨Îĵµ¸ùĿ¼£¬ÆäÖаüÀ¨ÍøÕ¾Îļþ¡£
3. ÆôÓÃÐéÄâÖ÷»ú
½«ÐéÄâÖ÷»úÉèÖÃÎļþÁ´½Óµ½ /etc/nginx/sites-enabled/ Ŀ¼¡£
ÔËÐÐÒÔÏÂÏÂÁ
sudo ln -s /etc/nginx/sites-available/yourdomain.com.conf /etc/nginx/sites-enabled/yourdomain.com.conf
µÇ¼ºó¸´ÖÆ
4. ÖØмÓÔØ nginx
ÔËÐÐÒÔÏÂÏÂÁîÖØмÓÔØ nginx£º
sudo systemctl reload nginx
µÇ¼ºó¸´ÖÆ
ÆäËûÉèÖÃÑ¡Ïî
Äú»¹¿ÉÒÔÉèÖÃÆäËûÉèÖã¬ÀýÈ磺
ÈÕÖ¾Îļþ
SSL Ö¤Êé
»á¼û¿ØÖÆ
Öض¨Ïò
²âÊÔÐéÄâÖ÷»ú
ʹÓÃÓòÃû»ò IP µØµã»á¼ûÍøÕ¾ÒÔ²âÊÔÆäÊÇ·ñÕý³£ÊÂÇé¡£
¼ì²éЧÀÍÆ÷ÈÕÖ¾ÒÔÈ·±£Ã»Óйýʧ¡£
ÒÔÉϾÍÊÇnginxÔõÑùÉèÖÃÐéÄâÖ÷»úµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡