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

ÔõÑùʵÏÖNginxµÄÇëÇóÖض¨Ïòµ½HTTPSÉèÖÃ

ÔõÑùʵÏÖNginxµÄÇëÇóÖض¨Ïòµ½HTTPSÉèÖÃ

ÔÚ»¥ÁªÍøÇéÐÎÖУ¬°ü¹ÜÍøÕ¾µÄÇå¾²ÐÔÊÇÖÁ¹ØÖ÷ÒªµÄ¡£Ê¹ÓÃHTTPSЭÒé¿ÉÒÔ¼ÓÃÜÊý¾Ý´«Ê䣬±ÜÃâÖÐÑëÈ˹¥»÷ºÍÊý¾Ýй¶¡£Nginx×÷Ϊһ¿îÖ÷ÒªµÄWebЧÀÍÆ÷ºÍ·´ÏòÊðÀíЧÀÍÆ÷£¬ÌṩÁËÇ¿Ê¢µÄ¹¦Ð§À´ÊµÏÖÍøÕ¾µÄHTTPSÖض¨Ïò¡£½ÓÏÂÀ´£¬ÎÒÃǽ«·ÖÏíÔõÑùÔÚNginxÖÐÉèÖã¬ÊµÏÖÇëÇóÖض¨Ïòµ½HTTPSµÄ°ì·¨ºÍÏêϸ´úÂëʾÀý¡£

°ì·¨Ò»£º×°ÖÃSSLÖ¤Êé

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚЧÀÍÆ÷ÉÏ×°ÖÃSSLÖ¤Êé¡£Äã¿ÉÒÔ´ÓȨÍþµÄSSLÖ¤Êé½ÒÏþ»ú¹¹£¨CA£©¹ºÖÃSSLÖ¤Ê飬»òÕßÑ¡ÔñÃâ·ÑµÄSSLÖ¤Ê飬ºÃ±ÈLet¡¯s Encrypt¡£×°ÖÃSSLÖ¤Êéºó£¬È·±£ÔÚNginxµÄÉèÖÃÖÐ׼ȷָ¶¨Ö¤ÊéºÍ˽ԿµÄ·¾¶¡£

°ì·¨¶þ£ºNginxÉèÖÃ

ÔÚNginxµÄÉèÖÃÎļþÖУ¬ÕÒµ½ÄãµÄÍøÕ¾ÉèÖã¨Í¨³£ÔÚ/etc/nginx/sites-available/Ŀ¼Ï£©£¬ÐÞ¸ÄÉèÖÃÒÔʵÏÖÇëÇóÖض¨Ïòµ½HTTPS¡£

server {
    listen 80;
    server_name your_domain.com;

    location / {
        return 301 https://$server_name$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name your_domain.com;

    ssl_certificate /path/to/your_ssl_certificate.crt;
    ssl_certificate_key /path/to/your_ssl_certificate_key.key;

    # ÆäËûSSLÉèÖÃ
    # ...

    location / {
        # ÆäËûÉèÖÃ
        # ...
    }
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄÉèÖÃÖУ¬ÎÒÃǽç˵ÁËÁ½¸öserver¿é¡£µÚÒ»¸öserver¿é¼àÌý80¶Ë¿Ú£¬ÉèÖÃÁËÇëÇóÖض¨Ïòµ½HTTPSµÄ¹æÔò£»µÚ¶þ¸öserver¿é¼àÌý443¶Ë¿Ú£¬ÉèÖÃÁËHTTPSµÄÖ¤ÊéºÍÆäËûSSLÑ¡Ïî¡£µ±ÓзÿÍͨ¹ýHTTP»á¼ûÍøվʱ£¬Nginx»á·µ»ØÒ»¸ö301Öض¨Ïòµ½ÏàͬµÄURL£¬µ«Ð­ÒéÊÇHTTPS¡£

°ì·¨Èý£ºÖØÆôNginxЧÀÍ

Íê³ÉÉèÖú󣬼ǵÃÖØÆôNginxЧÀÍ£¬Ê¹ÉèÖÃÉúЧ¡£

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

×ܽá

ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇʵÏÖÁËNginxµÄÇëÇóÖض¨Ïòµ½HTTPSÉèÖá£ÔÚÏÖʵ²Ù×÷ÖУ¬¿ÉÒÔƾ֤ÏêϸµÄÐèÇóºÍÇéÐÎ×öһЩÊʵ±µÄµ÷½â£¬ºÃ±ÈÌí¼ÓHSTS£¨HTTP Strict Transport Security£©Í·²¿£¬ÒÔÌá¸ßÇå¾²ÐÔ¡£Ï£Íû±¾ÎÄËùÊö¶ÔÄãÓÐËù×ÊÖú£¬ÈÃÄãµÄÍøÕ¾ÓµÓиüÇå¾²µÄ»á¼ûÇéÐΡ£

ÒÔÉϾÍÊÇÔõÑùʵÏÖNginxµÄÇëÇóÖض¨Ïòµ½HTTPSÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ