Nginx Proxy Managerϵľ²Ì¬Îļþ»º´æÓëѹËõÓÅ»¯
Nginx Proxy Managerϵľ²Ì¬Îļþ»º´æÓëѹËõÓÅ»¯
NginxÊÇÒ»¿î¸ßÐÔÄܵÄWebЧÀÍÆ÷ºÍ·´ÏòÊðÀíЧÀÍÆ÷£¬¶øNginx Proxy ManagerÊÇÒ»¸ö»ùÓÚNginxµÄÖÎÀí¹¤¾ß£¬¿ÉÒÔÇáËÉÖÎÀí¶à¸öÐéÄâÖ÷»úºÍ·´ÏòÊðÀí¡£ÔÚʹÓÃNginx Proxy Manager´î½¨Íøվʱ£¬ÓÅ»¯¾²Ì¬ÎļþµÄ»º´æºÍѹËõÊÇÊ®·ÖÖ÷ÒªµÄ£¬¿ÉÒÔÌáÉýÍøÕ¾µÄÐÔÄܺͼÓÔØËÙÂÊ¡£±¾ÎĽ«ÏêϸÏÈÈÝÔõÑùÔÚNginx Proxy ManagerϾÙÐо²Ì¬ÎļþµÄ»º´æÓëѹËõÓÅ»¯£¬²¢ÌṩһЩÏÖʵµÄ´úÂëʾÀý¹©²Î¿¼¡£
¾²Ì¬Îļþ»º´æÓÅ»¯
¾²Ì¬Îļþ°üÀ¨Í¼Æ¬¡¢JavaScriptÎļþ¡¢CSSÎļþµÈ£¬ËüÃDz»»áƵÈԱ任£¬Òò´Ë¿É¾ÙÐлº´æ£¬ïÔÌЧÀÍÆ÷µÄ¸ºÔغÍÌáÉýÓû§»á¼ûËÙÂÊ¡£ÔÚNginx Proxy ManagerÖÐÉèÖþ²Ì¬ÎļþµÄ»º´æºÜÊǼòÆÓ£¬Ö»ÐèÔÚNginxÉèÖÃÎļþÖÐÌí¼ÓÒÔÏ´úÂ룺
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ { expires 1d; }
µÇ¼ºó¸´ÖÆ
ÒÔÉÏ´úÂ뽫ÉèÖûº´æʱ¼äΪ1Ìì¡£¿ÉÒÔƾ֤ÐèÒªµ÷½âexpiresµÄÖµ£¬ÀýÈçexpires 1hÌåÏÖ1Сʱ£¬expires 1wÌåÏÖ1ÖÜ£¬ÒÔ´ËÀàÍÆ¡£
µã»÷ÏÂÔØ¡°àËÃûÌÃѹËõ¾Þ½³¡±£»
¾²Ì¬ÎļþѹËõÓÅ»¯
¾²Ì¬ÎļþµÄѹËõ¿ÉÒÔïÔÌÎļþ¾Þϸ£¬´Ó¶øïÔÌÍøÂç´«ÊäµÄÊý¾ÝÁ¿£¬ÌáÉýÍøÕ¾µÄ¼ÓÔØËÙÂÊ¡£ÔÚNginx Proxy ManagerÏ£¬¿ÉÒÔʹÓÃgzipÄ£¿é¾ÙÐо²Ì¬ÎļþµÄѹËõ¡£Ê×ÏÈ£¬È·ÈÏЧÀÍÆ÷ÉÏÒѾװÖÃÁËgzipÄ£¿é£¬È»ºóÔÚNginxÉèÖÃÎļþÖÐÌí¼ÓÒÔÏ´úÂ룺
gzip on; gzip_min_length 1000; gzip_types text/plain text/css application/javascript application/json application/x-javascript text/javascript;
µÇ¼ºó¸´ÖÆ
ÒÔÉÏ´úÂ뽫ÆôÓÃgzipѹËõ£¬²¢ÉèÖÃ×îСѹËõÎļþ¾ÞϸΪ1000×Ö½Ú¡£gzip_typesÖ¸¶¨ÐèҪѹËõµÄÎļþÀàÐÍ£¬ÉÏÊö´úÂëÖаüÀ¨Á˳£¼ûµÄÎı¾ÎļþºÍJavaScriptÎļþ¡£¿ÉÒÔƾ֤ÏÖÕæÏàÐξÙÐе÷½â¡£
¾²Ì¬Îļþ»º´æºÍѹËõÓÅ»¯µÄÍêÕûʾÀý
ÏÂÃæÊÇÒ»¸öÍêÕûµÄNginx Proxy ManagerÉèÖÃÎļþʾÀý£¬°üÀ¨Á˾²Ì¬Îļþ»º´æºÍѹËõµÄÓÅ»¯ÉèÖãº
server { listen 80; server_name example.com; location ~* .(jpg|jpeg|png|gif|ico|css|js)$ { expires 1d; } location / { proxy_pass http://backend_server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } gzip on; gzip_min_length 1000; gzip_types text/plain text/css application/javascript application/json application/x-javascript text/javascript; }
µÇ¼ºó¸´ÖÆ
ÔÚÉÏÊöʾÀýÖУ¬listenÖ¸¶¨Á˼àÌýµÄ¶Ë¿Ú£¬server_nameÖ¸¶¨ÁËÓòÃû¡£¾²Ì¬ÎļþµÄ»º´æºÍѹËõÉèÖ÷ÅÔÚÁËÏìÓ¦µÄlocation¿éÄÚ¡£Í¬Ê±£¬¸ÃʾÀý»¹°üÀ¨ÁË·´ÏòÊðÀíµÄÉèÖ㬿ÉÒÔδÀ´×Ô¿Í»§¶ËµÄÇëÇóת·¢µ½ºó¶ËЧÀÍÆ÷¡£
×ܽ᣺
ͨ¹ýÔÚNginx Proxy ManagerÖоÙÐо²Ì¬ÎļþµÄ»º´æºÍѹËõÓÅ»¯£¬¿ÉÒÔÓÐÓÃÌáÉýÍøÕ¾µÄÐÔÄܺͼÓÔØËÙÂÊ¡£¾²Ì¬Îļþ»º´æ¿ÉÒÔ¼õÇáЧÀÍÆ÷µÄ¸ºÔغͼÓËÙÓû§»á¼ûËÙÂÊ£¬¶ø¾²Ì¬ÎļþѹËõ¿ÉÒÔïÔÌÎļþ¾Þϸ£¬ïÔÌÍøÂç´«ÊäµÄÊý¾ÝÁ¿¡£Ê¹ÓÃNginxµÄÇ¿Ê¢¹¦Ð§£¬ÎÒÃÇ¿ÉÒÔÇáËÉʵÏÖÕâЩÓÅ»¯²½·¥¡£Ï£ÍûÒÔÉÏÄÚÈݶÔÄúÓÐËù×ÊÖú£¬×£ÄúµÄÍøÕ¾Ô½·¢¸ßЧºÍÓÅ»¯£¡
ÒÔÉϾÍÊÇNginx Proxy Managerϵľ²Ì¬Îļþ»º´æÓëѹËõÓÅ»¯µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡