nginxÔÚwindowsÖÐÔõôÉèÖÃ
ÔõÑùÔÚ windows ÖÐÉèÖà nginx£¿×°Öà nginx ²¢½¨ÉèÐéÄâÖ÷»úÉèÖá£ÐÞ¸ÄÖ÷ÉèÖÃÎļþ²¢°üÀ¨ÐéÄâÖ÷»úÉèÖá£Æô¶¯»òÖØмÓÔØ nginx¡£²âÊÔÉèÖò¢Éó²éÍøÕ¾¡£Ñ¡ÔñÐÔÆôÓà ssl ²¢ÉèÖà ssl Ö¤Ê顣ѡÔñÐÔÉèÖ÷À»ðǽÔÊÐí 80 ºÍ 443 ¶Ë¿ÚÁ÷Á¿¡£
ÔõÑùÔÚ Windows ÖÐÉèÖÃ Nginx
Nginx ÊÇÒ»¸öÊ¢ÐÐµÄ Web ЧÀÍÆ÷£¬Ëü¿ÉÒÔÔÚ Windows ²Ù×÷ϵͳÉÏÉèÖúÍʹÓá£ÒÔÏÂÊÇÔõÑùÔÚ Windows ÖÐ×°ÖúÍÉèÖà Nginx£º
1. ×°ÖÃ Nginx
´Ó Nginx µÄ¹Ù·½ÍøÕ¾ÏÂÔØ×îÐ嵀 Windows ×°Öðü¡£
Ë«»÷×°Öðü²¢Æ¾Ö¤ÌáÐѾÙÐвÙ×÷¡£
Íê³É×°Öúó£¬Nginx ЧÀͽ«×Ô¶¯Æô¶¯¡£
2. ÉèÖÃ Nginx
½¨ÉèÐéÄâÖ÷»úÉèÖãºÊ¹ÓüÇʱ¾»òÆäËûÎı¾±à¼Æ÷½¨ÉèÈçÏÂÎļþ£º
C:\nginx\conf\vhost.conf
µÇ¼ºó¸´ÖÆ
½«ÒÔÏÂÄÚÈÝÌí¼Óµ½ÎļþÖУº
server { listen 80; server_name example.com; root C:/path/to/your/website; index index.html index.php; }
µÇ¼ºó¸´ÖÆ
Ìæ»» example.com ΪÄúµÄÓòÃû£¬²¢½« C:/path/to/your/website Ì滻ΪÍøÕ¾ÎļþµÄÏÖʵ·¾¶¡£
ÐÞ¸Ä Nginx Ö÷ÉèÖÃÎļþ£º·¿ªÒÔÏÂÎļþ£º
C:\nginx\conf\nginx.conf
µÇ¼ºó¸´ÖÆ
Ìí¼ÓÒÔÏÂÄÚÈÝ£º
include vhost.conf;
µÇ¼ºó¸´ÖÆ
ÉúÑĸü¸Ä¡£
3. Æô¶¯»òÖØмÓÔØ Nginx
ÈôÊÇ Nginx ÕýÔÚÔËÐУ¬ÇëÖØмÓÔØÉèÖãº
net stop nginx net start nginx
µÇ¼ºó¸´ÖÆ
ÈôÊÇ Nginx ûÓÐÔËÐУ¬ÇëÆô¶¯Ëü£º
net start nginx
µÇ¼ºó¸´ÖÆ
4. ²âÊÔÉèÖÃ
ÔÚä¯ÀÀÆ÷Öлá¼ûÄúµÄÓòÃû¡£ÈôÊÇÄú¿´µ½ÍøÕ¾£¬ÔòÌåÏÖ Nginx ÉèÖÃÀֳɡ£
5. ÆôÓà SSL£¨¿ÉÑ¡£©
»ñÈ¡ SSL Ö¤Êé¡£
½«Ö¤ÊéÎļþ¸´ÖƵ½ Nginx µÄ conf Ŀ¼ÖС£
ÔÚÄúµÄÐéÄâÖ÷»úÉèÖÃÖÐÉèÖà SSL£º
server { listen 443 ssl; server_name example.com; root C:/path/to/your/website; index index.html index.php; ssl_certificate ssl.crt; ssl_certificate_key ssl.key; }
µÇ¼ºó¸´ÖÆ
ÖØмÓÔØ Nginx ÉèÖá£
6. ÉèÖ÷À»ðǽ£¨¿ÉÑ¡£©
ÔÊÐí Nginx 80 ºÍ 443 ¶Ë¿ÚµÄÈëÕ¾Á÷Á¿¡£
ÄúÏÖÔÚÒÑÔÚ Windows ÖÐÀÖ³ÉÉèÖà Nginx¡£
ÒÔÉϾÍÊÇnginxÔÚwindowsÖÐÔõôÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡