<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>可望</title><link>http://www.kewang.asia/</link><description>Good Luck To You!</description><item><title>PS界面右上角出现的“Time to Update”怎么关闭？---转载</title><link>http://www.kewang.asia/?id=67</link><description>&lt;div&gt;&lt;div&gt;&lt;p data-pid=&quot;8XJxlE8J&quot;&gt;1. Close Photoshop if open&lt;/p&gt;&lt;p data-pid=&quot;0f5DwYKq&quot;&gt;2. Navigate to &amp;quot;C:\Program Files\Adobe\Adobe Photoshop 2023\Required\UXP\com.adobe.&lt;a class=&quot;RichContent-EntityWord css-b7erz1&quot; data-za-not-track-link=&quot;true&quot; data-paste-text=&quot;true&quot; href=&quot;https://zhida.zhihu.com/search?content_id=605921057&amp;content_type=Answer&amp;match_order=1&amp;q=photoshop&amp;zd_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ6aGlkYV9zZXJ2ZXIiLCJleHAiOjE3Njk1OTE2ODEsInEiOiJwaG90b3Nob3AiLCJ6aGlkYV9zb3VyY2UiOiJlbnRpdHkiLCJjb250ZW50X2lkIjo2MDU5MjEwNTcsImNvbnRlbnRfdHlwZSI6IkFuc3dlciIsIm1hdGNoX29yZGVyIjoxLCJ6ZF90b2tlbiI6bnVsbH0.3_fqpaYPiZiQ0WoHQr6FmrsBnNHJ4tqWCeFjWgcypf0&amp;zhida_source=entity&quot; target=&quot;_blank&quot;&gt;photoshop&lt;svg width=&quot;10px&quot; height=&quot;10px&quot; viewbox=&quot;0 0 16 16&quot; class=&quot;ZDI ZDI--FourPointedStar16 css-1dvsrp&quot; fill=&quot;currentColor&quot;&gt;&lt;path d=&quot;m5.068 9.267-3.08-.77a.512.512 0 0 1 0-.994l3.08-.77a2.289 2.289 0 0 0 1.665-1.665l.77-3.08a.512.512 0 0 1 .994 0l.77 3.08c.205.82.845 1.46 1.665 1.665l3.08.77a.512.512 0 0 1 0 .994l-3.08.77a2.29 2.29 0 0 0-1.665 1.665l-.77 3.08a.512.512 0 0 1-.994 0l-.77-3.08a2.289 2.289 0 0 0-1.665-1.665Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;.inAppMessaging\js&amp;quot;&lt;/p&gt;&lt;p data-pid=&quot;KXN1uu6B&quot;&gt;3. Locate the javaScript File &amp;quot;0.js&amp;quot;&lt;/p&gt;&lt;p data-pid=&quot;H0kx33RO&quot;&gt;4. Open the 0.js file in a text editor (Notepad, Notepad++, etc)&lt;/p&gt;&lt;p data-pid=&quot;lYofRHiU&quot;&gt;5. Search for 996633 in the file. You may see two entries. Locate the first instance.&lt;/p&gt;&lt;p data-pid=&quot;hBv2VyHy&quot;&gt;6. Input &amp;quot;,display:none&amp;quot; (including the comma) right after &amp;quot;996633&amp;quot; (after the quotation marks no spaces)&lt;/p&gt;&lt;p data-pid=&quot;MzyHQ1Yg&quot;&gt;7. Save the file&lt;/p&gt;&lt;p data-pid=&quot;irMJc47V&quot;&gt;注：紧接着引号没有空格，然后输入&amp;quot;,display:none&amp;quot; 有个逗号&lt;/p&gt;&lt;p data-pid=&quot;3F7Ijigi&quot;&gt;注：win和mac都适用&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Mon, 26 Jan 2026 17:19:13 +0800</pubDate></item><item><title>《绿皮书》：看后有感----借助ai工具</title><link>http://www.kewang.asia/?id=66</link><description>&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;0&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;h1 class=&quot;heading-h1&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;在电影艺术的殿堂中，《绿皮书》宛如一颗璀璨明珠，散发着经久不衰的魅力。这部由彼得・法拉利执导，维果・莫特森和马赫沙拉・阿里主演的影片，以其深刻的内涵、细腻的情感和精湛的叙事，为观众呈现了一场触动灵魂的视听盛宴。它不仅仅是一部电影，更是一面映照人性、社会与历史的镜子，引领我们深入探寻那些被岁月尘封的故事与情感。&lt;/span&gt;&lt;/h1&gt;&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;2&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;h2 class=&quot;heading-h2&quot;&gt;一、历史回音：种族隔离阴影下的艰难跋涉&lt;/h2&gt;&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;3&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;影片将故事背景设定在 20 世纪 60 年代的美国，那是一段种族隔离与歧视盛行的黑暗时期。《绿皮书》作为当时黑人出行的特殊指南，标注着黑人可涉足的有限场所，这一细节成为种族歧视具象化的有力象征，时刻提醒着黑人在社会中的艰难处境。从繁华都市到偏远小镇，黑人面临着无处不在的歧视，他们不能使用白人的厕所，无法在白人餐馆用餐，甚至在服装店试穿衣服的权利都被剥夺。唐・雪利，这位才华横溢的黑人钢琴家，即便拥有卓越的音乐造诣和高雅的气质，也难以逃脱种族歧视的阴霾。他在巡演途中遭受的种种不公，如在高档餐厅被拒之门外、在演出场所被安排在简陋的储物间，生动地展现了当时社会的严重不公，让观众深切感受到黑人所承受的苦难与无奈。这些场景不仅是对历史的真实还原，更是对种族歧视的有力控诉，促使我们反思那段不公正的过去。&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;4&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;h2 class=&quot;heading-h2&quot;&gt;二、角色交响：跨越差异的心灵共鸣&lt;/h2&gt;&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;5&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;托尼・利普，一个来自底层的白人，性格粗犷豪放，带着意大利裔美国人的直率与热情。他生活在社会边缘，为生计奔波，对黑人有着根深蒂固的偏见。而唐・雪利则截然不同，他出身优渥，接受过良好教育，举止优雅，是音乐领域的璀璨明星。然而，在白人主导的社会中，他始终被视为异类，孤独而迷茫。这两个性格、背景天差地别的人物，在一次偶然的雇佣关系中走到了一起。起初，他们之间充满了误解与冲突，托尼对唐的高雅气质感到陌生与排斥，唐则对托尼的粗俗举止难以认同。但随着南方巡演的深入，他们在朝夕相处中逐渐发现彼此的闪光点。托尼被唐的音乐才华所折服，开始理解并尊重他的艺术追求；唐则在托尼的真诚与善良中感受到温暖，学会了放下防备，拥抱生活的真实与质朴。他们在旅途中相互影响、共同成长，托尼教唐享受炸鸡这种简单的快乐，唐则帮助托尼提升文化素养，教他写信表达情感。这种跨越种族与阶层的友谊，如同黑暗中的明灯，照亮了彼此的心灵，也为影片注入了温暖而动人的力量。&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;6&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;h2 class=&quot;heading-h2&quot;&gt;三、叙事旋律：公路旅程中的情感变奏&lt;/h2&gt;&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;7&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;《绿皮书》采用了经典的公路电影叙事模式，以托尼和唐的南方巡演之旅为主线，串联起一系列扣人心弦的故事。影片巧妙地将种族问题、人物情感与社会现实融入这段旅程之中，使观众在跟随主角们穿越美国南方大地的同时，也深入体验到那个时代的复杂与多元。旅途中，他们遭遇了各种困难与挑战，从恶劣的自然环境到人为的歧视与不公，每一次挫折都成为他们关系发展的转折点。例如，在肯塔基州，唐在白人酒吧遭受暴打，托尼及时赶到解救了他，这次事件让他们的关系从单纯的雇佣走向了更深层次的信任；在北卡罗来纳州，唐因使用洗手间问题与白人发生冲突，托尼坚定地站在他身边，维护他的尊严，进一步加深了他们之间的友谊。而在伯明翰的黑人酒吧演出，则是影片的情感高潮。唐在这里放下了对白人社会的迎合与期待，尽情演奏属于黑人文化的音乐，与黑人观众产生了强烈的情感共鸣。这场演出不仅是唐音乐生涯的一次突破，更是他自我身份认同的重要时刻。通过这些情节的层层推进，影片成功地描绘了托尼和唐之间从陌生到熟悉、从偏见对立到相互理解与尊重的情感转变过程，让观众在跌宕起伏的故事中感受到人性的美好与力量。&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;8&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;h2 class=&quot;heading-h2&quot;&gt;四、视听和声：光影与音乐交织的艺术盛宴&lt;/h2&gt;&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;9&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;影片在视听语言方面堪称一绝，为观众带来了一场无与伦比的艺术享受。在画面呈现上，导演精心雕琢每一个场景，从纽约夜总会的喧嚣热闹到唐居住公寓的高雅静谧，从南方白人高档餐厅的奢华到黑人专用场所的简陋破败，通过鲜明的对比，生动地展现了不同阶层、不同种族之间的巨大差异。同时，导演巧妙运用镜头语言来刻画人物情感与关系变化。如托尼和唐初次见面时，采用全景镜头展示两人在空间上的距离，暗示他们内心的隔阂；而随着剧情发展，特写镜头逐渐增多，捕捉他们细微的表情与眼神交流，体现出他们情感的升温。在灯光运用上，也极具匠心。唐在剧院为白人演出时，舞台灯光强烈而刺眼，台下观众隐没在黑暗中，凸显出他的孤独与被孤立；而在黑人酒吧演出时，暖色调的灯光照亮整个舞台与观众席，营造出和谐、温暖的氛围，象征着唐找到了归属感。音乐作为影片的另一大亮点，与剧情完美融合，相得益彰。唐演奏的古典音乐与爵士乐，时而悠扬婉转，时而激情澎湃，不仅展现了他卓越的音乐才华，更成为他表达内心世界、传递情感的重要媒介。同时，影片中的背景音乐也根据不同场景与情感氛围进行精心挑选，如在紧张刺激的冲突场景中，节奏强烈的音乐增强了紧张感；在温馨感人的时刻，舒缓柔和的旋律则触动着观众的心弦，使观众更加深入地沉浸在影片所营造的情感世界之中。&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;10&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;h2 class=&quot;heading-h2&quot;&gt;五、主题升华：友谊、勇气与平等的永恒追求&lt;/h2&gt;&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;11&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;《绿皮书》不仅仅是一个关于友谊的故事，它更是对种族平等、人性尊严以及社会变革的深刻探讨。通过托尼和唐的经历，影片向我们展示了在极端的种族歧视环境下，友谊的力量可以跨越一切障碍，让人们看到彼此内心深处的善良与美好。唐在面对种种不公时，始终保持着对尊严的坚守和对音乐梦想的执着追求，他用自己的勇气和才华向这个不公平的世界发起挑战。而托尼从最初的偏见与歧视，到逐渐被唐所影响，最终成为他坚定的支持者，这一转变过程也象征着人性的觉醒与成长。影片的结尾，唐在圣诞节时来到托尼家中，与他的家人共度佳节，这一场景不仅是两人友谊的升华，更是对种族和谐共处的美好期许。它向我们传递了一个深刻的信息：无论种族、文化或阶层的差异有多大，只要我们拥有理解、包容与爱的胸怀，就能够打破偏见的枷锁，实现真正的平等与和谐。在当今社会，种族问题依然存在，《绿皮书》所传达的主题依然具有强烈的现实意义，它提醒我们要时刻保持对平等与正义的追求，用爱与勇气去消除世间的一切偏见与歧视。&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;12&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;《绿皮书》以其深刻的主题、丰满的人物形象、精彩的叙事和卓越的视听表现，成为电影史上的一部经典之作。它让我们在欣赏精彩故事的同时，也对种族问题、人性光辉以及社会变革有了更深入的思考。这部电影宛如一面镜子，映照出我们内心深处的善良与丑恶，也激励着我们为构建一个更加公平、和谐、美好的世界而努力奋斗。每当我们回味这部影片时，那些温暖感人的画面、动人心弦的音乐以及深刻的人生哲理，都将如同璀璨星辰，在我们的记忆长河中熠熠生辉，永远散发着触动灵魂的力量。&lt;/div&gt;&lt;div data-zone-id=&quot;0&quot; data-line-index=&quot;13&quot; data-line=&quot;true&quot; style=&quot;white-space: pre-wrap;&quot;&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 17 Jul 2025 09:26:21 +0800</pubDate></item><item><title>滕王阁序(很喜欢，放上来)</title><link>http://www.kewang.asia/?id=65</link><description>&lt;div class=&quot;contson&quot; id=&quot;contsonce802de625e5&quot; style=&quot;padding: 0px; margin: 10px 0px 0px; color: rgb(15, 15, 15); clear: both; overflow: hidden; font-family: ����, Arial, Helvetica; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(240, 239, 226);&quot;&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;　　豫章故郡，洪都新府。星分翼轸，地接衡庐。襟三江而带五湖，控蛮荆而引瓯越。物华天宝，龙光射牛斗之墟；人杰地灵，徐孺下陈蕃之榻。雄州雾列，俊采星驰。台隍枕夷夏之交，宾主尽东南之美。都督阎公之雅望，棨戟遥临；宇文新州之懿范，襜帷暂驻。十旬休假，胜友如云；千里逢迎，高朋满座。腾蛟起凤，孟学士之词宗；紫电青霜，王将军之武库。家君作宰，路出名区；童子何知，躬逢胜饯。(豫章故郡 一作：南昌故郡；青霜 一作：清霜)&lt;/p&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;　　时维九月，序属三秋。潦水尽而寒潭清，烟光凝而暮山紫。俨骖騑于上路，访风景于崇阿。临帝子之长洲，得天人之旧馆。层峦耸翠，上出重霄；飞阁流丹，下临无地。鹤汀凫渚，穷岛屿之萦回；桂殿兰宫，即冈峦之体势。（天人 一作：仙人；层峦 一作：层台；即冈 一作：列冈；飞阁流丹 一作：飞阁翔丹）&lt;/p&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;&lt;span style=&quot;font-family: 宋体, SimSun;&quot;&gt;&lt;/span&gt;　　披绣闼，俯雕甍，山原旷其盈视，川泽纡其骇瞩。闾阎扑地，钟鸣鼎食之家；舸舰迷津，青雀黄龙之舳。云销雨霁，彩彻区明。落霞与孤鹜齐飞，秋水共长天一色。渔舟唱晚，响穷彭蠡之滨，雁阵惊寒，声断衡阳之浦。(迷津 一作：弥津；云销雨霁，彩彻区明 一作：虹销雨霁，彩彻云衢)&lt;/p&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;　　遥襟甫畅，逸兴遄飞。爽籁发而清风生，纤歌凝而白云遏。睢园绿竹，气凌彭泽之樽；邺水朱华，光照临川之笔。四美具，二难并。穷睇眄于中天，极娱游于暇日。天高地迥，觉宇宙之无穷；兴尽悲来，识盈虚之有数。望长安于日下，目吴会于云间。地势极而南溟深，天柱高而北辰远。关山难越，谁悲失路之人；萍水相逢，尽是他乡之客。怀帝阍而不见，奉宣室以何年？(遥襟甫畅 一作：遥吟俯畅)&lt;/p&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;　　嗟乎！时运不齐，命途多舛。冯唐易老，李广难封。屈贾谊于长沙，非无圣主；窜梁鸿于海曲，岂乏明时？所赖君子见机，达人知命。老当益壮，宁移白首之心？穷且益坚，不坠青云之志。酌贪泉而觉爽，处涸辙以犹欢。北海虽赊，扶摇可接；东隅已逝，桑榆非晚。孟尝高洁，空余报国之情；阮籍猖狂，岂效穷途之哭！(见机 一作：安贫；以犹欢 一作：而相欢)&lt;/p&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;　　勃，三尺微命，一介书生。无路请缨，等终军之弱冠；有怀投笔，慕宗悫之长风。舍簪笏于百龄，奉晨昏于万里。非谢家之宝树，接孟氏之芳邻。他日趋庭，叨陪鲤对；今兹捧袂，喜托龙门。杨意不逢，抚凌云而自惜；钟期既遇，奏流水以何惭？&lt;/p&gt;&lt;p style=&quot;padding: 0px; margin-top: 0px; margin-bottom: 15px; line-height: 32px;&quot;&gt;　　呜呼！胜地不常，盛筵难再；兰亭已矣，梓泽丘墟。临别赠言，幸承恩于伟饯；登高作赋，是所望于群公。敢竭鄙怀，恭疏短引；一言均赋，四韵俱成。请洒潘江，各倾陆海云尔。&lt;br/&gt;　　滕王高阁临江渚，佩玉鸣鸾罢歌舞。&lt;br/&gt;　　画栋朝飞南浦云，珠帘暮卷西山雨。&lt;br/&gt;　　闲云潭影日悠悠，物换星移几度秋。&lt;br/&gt;　　阁中帝子今何在？槛外长江空自流。&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 08 Jul 2025 15:52:00 +0800</pubDate></item><item><title>再分享一首喜欢的诗，你还在我身旁</title><link>http://www.kewang.asia/?id=64</link><description>&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;你还在我身旁&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 戴畅&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 瀑布的水逆流而上，&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　&lt;/span&gt;&lt;a href=&quot;https://zhidao.baidu.com/search?word=%E8%92%B2%E5%85%AC%E8%8B%B1&amp;fr=iknow_pc_qb_highlight&quot; highlight=&quot;true&quot; rel=&quot;nofollow noopener&quot; style=&quot;color: rgb(74, 202, 109); text-decoration-line: none; display: inline; position: relative; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;&gt;蒲公英&lt;/a&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;种子从远处飘回，聚成伞的模样，&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　太阳从西边升起，落向东方。&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　子弹退回枪膛，&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　运动员回到&lt;/span&gt;&lt;a href=&quot;https://zhidao.baidu.com/search?word=%E8%B5%B7%E8%B7%91%E7%BA%BF&amp;fr=iknow_pc_qb_highlight&quot; highlight=&quot;true&quot; rel=&quot;nofollow noopener&quot; style=&quot;color: rgb(74, 202, 109); text-decoration-line: none; display: inline; position: relative; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;&gt;起跑线&lt;/a&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;上，&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　我交回&lt;/span&gt;&lt;a href=&quot;https://zhidao.baidu.com/search?word=%E5%BD%95%E5%8F%96%E9%80%9A%E7%9F%A5%E4%B9%A6&amp;fr=iknow_pc_qb_highlight&quot; highlight=&quot;true&quot; rel=&quot;nofollow noopener&quot; style=&quot;color: rgb(74, 202, 109); text-decoration-line: none; display: inline; position: relative; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;&gt;录取通知书&lt;/a&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;，忘了十年寒窗。&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　厨房里飘来饭菜的香，&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　你把我的卷子签好名字，&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　关掉电视，帮我把书包背上。&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　你还在我身旁&lt;/span&gt;&lt;/p&gt;</description><pubDate>Mon, 07 Jul 2025 09:30:23 +0800</pubDate></item><item><title>喜欢的一首小诗，分享出来</title><link>http://www.kewang.asia/?id=63</link><description>&lt;p&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;怒&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　何故&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　昨日暮&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　偶遇见她&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　把纤纤玉手&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　交那衰人牵住&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　盈盈笑语左右顾&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　神采飞扬凌波微步&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　美眸中一片深情倾注&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　似前年与我同在湖畔路&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　也这般附耳交顾低语倾诉&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　如今见我头也不点形同陌路&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　我发现自己旧情难忘六神无主&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　两眼痴呆双脚生根心内如被汤煮&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　像我这么优秀的男子她总嫌我老土&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　那土鳖相貌恶心行止猥琐她爱他粗鲁&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　女孩子搞不清她想什么我越琢磨越胡涂&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　明知道她与自己不合适想忘记她另起灶炉&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　到头来都只能是剪不断理还乱最终于事无补&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　兄弟我长这么大从来没怕过谁却栽给了这个主&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　看来是上辈子欠她很多钱早知如此就不该和她堵&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　碰上她算我倒霉下次说什么也得找个温柔姑娘相处&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　总算明白这世上漂亮不能当饭吃往往还让你难堪重负&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　从现在起踏踏实实勤勤恳恳谦虚谨慎待人有礼爱护公物&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　切记过马路左右看要走人行斑马线要想富少生孩子多种树&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　化悲痛为力量一边努力学习一边时刻准备着开发祖国大西部&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　大丈夫何患无妻没有了你虽然孤独但也使我从此不再一叶障目&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　这也使我好好反思为什么会失败总结经验教训继续探索革命道路&lt;/span&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;br style=&quot;content: &amp;quot;&amp;quot;; display: block; height: 0px; margin: 20px 0px; width: 100%; color: rgb(51, 51, 51); font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;/&gt;&lt;span style=&quot;color: #333333; font-family: &amp;quot;PingFang SC&amp;quot;, &amp;quot;Lantinghei SC&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, arial, 宋体, sans-serif, tahoma; font-size: 16px; text-wrap-mode: wrap; background-color: #FFFFFF;&quot;&gt;　　我会遇上好姑娘没命地追她想她爱她决不放过她不管她属虎还属兔&lt;/span&gt;&lt;/p&gt;</description><pubDate>Mon, 07 Jul 2025 09:28:41 +0800</pubDate></item><item><title>被讨厌的勇气 - 阿德勒心理学（感觉不错的句子）</title><link>http://www.kewang.asia/?id=62</link><description>&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;能够改变自己的只有自己。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;原因论和目的论。后者为此书主张，即目的制造行为；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;决定我们自身的不是过去的经历，而是我们赋予经历的意义；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;改变的第一步就是理解。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;答案不应该是从别人那里得到，而应该是自己亲自找出来。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;重要的不是被给予了什么，而是如何去利用被给予的东西。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;之所以无法改变，是因为自己下了“不改变”的决心；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;即使&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;人们有各种不满，但还是认为保持现状更加轻松、更安心；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;目的论说：无论之前发生过什么，都对今后的人生&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;如何度过没有影响；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;我们并不是为了满足别人的期待而活着。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;别人如何评价你的选择，那是别人的课题，你根&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;本无法左右；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Fri, 04 Jul 2025 11:20:54 +0800</pubDate></item><item><title>关闭macOS中的SIP（System Integrity Protection）</title><link>http://www.kewang.asia/?id=61</link><description>&lt;ol style=&quot;text-wrap: wrap; box-sizing: inherit; padding-inline-start: 2em; margin-top: 0.859em; color: rgb(6, 6, 7); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif; letter-spacing: 0.5px; background-color: rgb(255, 255, 255);&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p style=&quot;box-sizing: inherit; line-height: 24px; margin-top: 0px; margin-bottom: 0px; max-width: 100%; overflow: visible; white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: 700;&quot;&gt;重启Mac进入恢复模式&lt;/span&gt;：&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;box-sizing: inherit; padding-inline-start: 2em; margin-top: 0.859em; margin-bottom: 0.859em; padding-left: 1.25em;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;对于搭载Intel处理器的Mac电脑，完全关机后开机时按住&amp;nbsp;&lt;code class=&quot;inlineCode___uUrJ9&quot; style=&quot;box-sizing: inherit; max-width: 100%; overflow: auto; text-align: justify; color: var(--brand-main); background-color: var(--color-brand-8); margin: 0 var(--gap-xs); padding: var(--gap-xs) var(--gap-sm); border-radius: var(--border-radius-xs); white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;Command + R&lt;/code&gt;&amp;nbsp;直到看到苹果标志。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;对于搭载Apple M1或M2芯片的Mac电脑，关机后按住电源键直到看到“正在载入启动选项...”提示，然后松开电源键，点击选项进入恢复模式&amp;nbsp;&lt;span class=&quot;docQuote___YIW6w&quot; data-testid=&quot;msh-ref-entrance&quot; style=&quot;box-sizing: inherit; margin: 0px 4px; position: relative; top: 3px; cursor: pointer; user-select: none; font-size: 16px; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--msh-chat-segment-quoteIcon-color); background-color: var(--msh-chat-segment-quoteIcon-bg);&quot;&gt;&lt;span role=&quot;img&quot; class=&quot;anticon MuiBox-root css-0&quot; style=&quot;box-sizing: inherit; display: inline-flex; color: inherit; line-height: 0; text-align: center; vertical-align: -0.125em; text-rendering: optimizelegibility; -webkit-font-smoothing: antialiased; align-items: center;&quot;&gt;&lt;svg width=&quot;1em&quot; height=&quot;1em&quot; fill=&quot;currentColor&quot; aria-hidden=&quot;true&quot; focusable=&quot;false&quot; class=&quot;&quot;&gt;&lt;use xlink:href=&quot;#mshd-seg-quote&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p style=&quot;box-sizing: inherit; line-height: 24px; margin-top: 0px; margin-bottom: 0px; max-width: 100%; overflow: visible; white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: 700;&quot;&gt;打开终端&lt;/span&gt;：&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;box-sizing: inherit; padding-inline-start: 2em; margin-top: 0.859em; margin-bottom: 0.859em; padding-left: 1.25em;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;在恢复模式界面，点击屏幕顶部的“实用工具”菜单，然后选择“终端”。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p style=&quot;box-sizing: inherit; line-height: 24px; margin-top: 0px; margin-bottom: 0px; max-width: 100%; overflow: visible; white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: 700;&quot;&gt;禁用SIP&lt;/span&gt;：&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;box-sizing: inherit; padding-inline-start: 2em; margin-top: 0.859em; margin-bottom: 0.859em; padding-left: 1.25em;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;在终端中输入命令&amp;nbsp;&lt;code class=&quot;inlineCode___uUrJ9&quot; style=&quot;box-sizing: inherit; max-width: 100%; overflow: auto; text-align: justify; color: var(--brand-main); background-color: var(--color-brand-8); margin: 0 var(--gap-xs); padding: var(--gap-xs) var(--gap-sm); border-radius: var(--border-radius-xs); white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;csrutil disable&lt;/code&gt;&amp;nbsp;然后按回车键。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;p style=&quot;box-sizing: inherit; line-height: 24px; margin-top: 0px; margin-bottom: 0px; max-width: 100%; overflow: visible; white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: 700;&quot;&gt;重启电脑&lt;/span&gt;：&lt;/p&gt;&lt;/li&gt;&lt;ul style=&quot;box-sizing: inherit; padding-inline-start: 2em; margin-top: 0.859em; margin-bottom: 0.859em; padding-left: 1.25em;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;SIP禁用后，重启电脑以使更改生效。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;p style=&quot;text-wrap: wrap; box-sizing: inherit; line-height: 24px; margin-top: 0.859em; margin-bottom: 0.859em; letter-spacing: 0.25px; max-width: 100%; overflow: auto hidden; color: rgb(6, 6, 7); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif; background-color: rgb(255, 255, 255); white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;要重新启用SIP，只需重复上述步骤，但在终端中输入 &lt;code class=&quot;inlineCode___uUrJ9&quot; style=&quot;box-sizing: inherit; max-width: 100%; overflow: auto; text-align: justify; color: var(--brand-main); background-color: var(--color-brand-8); margin: 0 var(--gap-xs); padding: var(--gap-xs) var(--gap-sm); border-radius: var(--border-radius-xs); word-break: break-word !important;&quot;&gt;csrutil enable&lt;/code&gt; 命令。&lt;/p&gt;&lt;p style=&quot;text-wrap: wrap; box-sizing: inherit; line-height: 24px; margin-top: 0px; margin-bottom: 0.859em; letter-spacing: 0.25px; max-width: 100%; overflow: auto hidden; color: rgb(6, 6, 7); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif; background-color: rgb(255, 255, 255); white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: 700;&quot;&gt;查看SIP状态&lt;/span&gt;：
在正常启动的macOS系统中打开“终端”，输入 &lt;code class=&quot;inlineCode___uUrJ9&quot; style=&quot;box-sizing: inherit; max-width: 100%; overflow: auto; text-align: justify; color: var(--brand-main); background-color: var(--color-brand-8); margin: 0 var(--gap-xs); padding: var(--gap-xs) var(--gap-sm); border-radius: var(--border-radius-xs); word-break: break-word !important;&quot;&gt;csrutil status&lt;/code&gt; 命令，如果显示“disabled”，则SIP当前是关闭的；如果显示“enabled”，则SIP是开启的 &lt;span class=&quot;docQuote___YIW6w&quot; data-testid=&quot;msh-ref-entrance&quot; style=&quot;box-sizing: inherit; margin: 0px 4px; position: relative; top: 3px; cursor: pointer; user-select: none; font-size: 16px; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--msh-chat-segment-quoteIcon-color); background-color: var(--msh-chat-segment-quoteIcon-bg);&quot;&gt;&lt;span role=&quot;img&quot; class=&quot;anticon MuiBox-root css-0&quot; style=&quot;box-sizing: inherit; display: inline-flex; color: inherit; line-height: 0; text-align: center; vertical-align: -0.125em; text-rendering: optimizelegibility; -webkit-font-smoothing: antialiased; align-items: center;&quot;&gt;&lt;svg width=&quot;1em&quot; height=&quot;1em&quot; fill=&quot;currentColor&quot; aria-hidden=&quot;true&quot; focusable=&quot;false&quot; class=&quot;&quot;&gt;&lt;use xlink:href=&quot;#mshd-seg-quote&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;。&lt;/p&gt;&lt;p class=&quot;last-node&quot; style=&quot;text-wrap: wrap; box-sizing: inherit; line-height: 24px; margin-top: 0px; margin-bottom: 0px; letter-spacing: 0.25px; max-width: 100%; overflow: auto hidden; color: rgb(6, 6, 7); font-family: -apple-system, blinkmacsystemfont, &amp;quot;Helvetica Neue&amp;quot;, helvetica, &amp;quot;segoe ui&amp;quot;, arial, roboto, &amp;quot;PingFang SC&amp;quot;, miui, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft Yahei&amp;quot;, sans-serif; background-color: rgb(255, 255, 255); white-space-collapse: preserve !important; word-break: break-word !important;&quot;&gt;请注意，禁用SIP可能会使您的系统面临安全风险，因此请确保在完成必要的操作后重新启用它。&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Fri, 27 Sep 2024 10:29:27 +0800</pubDate></item><item><title>Nginx 从入门到实践，万字详解！----转载</title><link>http://www.kewang.asia/?id=60</link><description>&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;原链接：&lt;a href=&quot;https://juejin.cn/post/6844904144235413512&quot; target=&quot;_self&quot;&gt;https://juejin.cn/post/6844904144235413512&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;相信作为开发者，大家都知道 Nginx 的重要，废话不多说，一起来学习吧。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;CentOS 版本：&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;7.6&lt;/code&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 版本：&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;1.16.1&lt;/code&gt;&lt;/p&gt;&lt;h2 data-id=&quot;heading-0&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;1. Nginx 介绍&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;传统的 Web 服务器，每个客户端连接作为一个单独的进程或线程处理，需在切换任务时将 CPU 切换到新的任务并创建一个新的运行时上下文，消耗额外的内存和 CPU 时间，当并发请求增加时，服务器响应变慢，从而对性能产生负面影响。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e967b9714ed~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;Nginx&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 是开源、高性能、高可靠的 Web 和反向代理服务器，而且支持热部署，几乎可以做到 7 * 24 小时不间断运行，即使运行几个月也不需要重新启动，还能在不间断服务的情况下对软件版本进行热更新。性能是 Nginx 最重要的考量，其占用内存少、并发能力强、能支持高达 5w 个并发连接数，最重要的是，Nginx 是免费的并可以商业化，配置使用也比较简单。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 的最重要的几个使用场景：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;静态资源服务，通过本地文件系统提供服务；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;反向代理服务，延伸出包括缓存、负载均衡等；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;API 服务，OpenResty ；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;对于前端来说 Node.js 不陌生了，Nginx 和 Node.js 的很多理念类似，HTTP 服务器、事件驱动、异步非阻塞等，且 Nginx 的大部分功能使用 Node.js 也可以实现，但 Nginx 和 Node.js 并不冲突，都有自己擅长的领域。Nginx 擅长于底层服务器端资源的处理（静态资源处理转发、反向代理，负载均衡等），Node.js 更擅长上层具体业务逻辑的处理，两者可以完美组合，共同助力前端开发。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;下面我们着重学习一下 Nginx 的使用。&lt;/p&gt;&lt;h2 data-id=&quot;heading-1&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;2. 相关概念&lt;/h2&gt;&lt;h3 data-id=&quot;heading-2&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;2.1 简单请求和非简单请求&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;首先我们来了解一下简单请求和非简单请求，如果同时满足下面两个条件，就属于简单请求：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;请求方法是&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;HEAD&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;GET&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;POST&lt;/code&gt;&amp;nbsp;三种之一；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;HTTP 头信息不超过右边着几个字段：&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Accept&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Accept-Language&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Content-Language&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Last-Event-ID&lt;/code&gt;&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Content-Type&lt;/code&gt;&amp;nbsp;只限于三个值&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;application/x-www-form-urlencoded&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;multipart/form-data&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;text/plain&lt;/code&gt;；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;凡是不同时满足这两个条件的，都属于非简单请求。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;浏览器处理简单请求和非简单请求的方式不一样：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;简单请求&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;对于简单请求，浏览器会在头信息中增加&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Origin&lt;/code&gt;&amp;nbsp;字段后直接发出，&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Origin&lt;/code&gt;&amp;nbsp;字段用来说明，本次请求来自的哪个源（协议+域名+端口）。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;如果服务器发现&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Origin&lt;/code&gt;&amp;nbsp;指定的源不在许可范围内，服务器会返回一个正常的 HTTP 回应，浏览器取到回应之后发现回应的头信息中没有包含&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Access-Control-Allow-Origin&lt;/code&gt;&amp;nbsp;字段，就抛出一个错误给 XHR 的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;error&lt;/code&gt;&amp;nbsp;事件；&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;如果服务器发现&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Origin&lt;/code&gt;&amp;nbsp;指定的域名在许可范围内，服务器返回的响应会多出几个&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Access-Control-&lt;/code&gt;&amp;nbsp;开头的头信息字段。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;非简单请求&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;非简单请求是那种对服务器有特殊要求的请求，比如请求方法是&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;PUT&lt;/code&gt;&amp;nbsp;或&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;DELETE&lt;/code&gt;，或&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Content-Type&lt;/code&gt;&amp;nbsp;值为&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;application/json&lt;/code&gt;。浏览器会在正式通信之前，发送一次 HTTP 预检&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;OPTIONS&lt;/code&gt;&amp;nbsp;请求，先询问服务器，当前网页所在的域名是否在服务器的许可名单之中，以及可以使用哪些 HTTP 请求方法和头信息字段。只有得到肯定答复，浏览器才会发出正式的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;XHR&lt;/code&gt;&amp;nbsp;请求，否则报错。&lt;/p&gt;&lt;h3 data-id=&quot;heading-3&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;2.2 跨域&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;在浏览器上当前访问的网站向另一个网站发送请求获取数据的过程就是&lt;span style=&quot;font-weight: 700&quot;&gt;跨域请求&lt;/span&gt;。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;跨域是浏览器的&lt;a href=&quot;https://link.juejin.cn/?target=https%3A%2F%2Fdeveloper.mozilla.org%2Fzh-CN%2Fdocs%2FWeb%2FSecurity%2FSame-origin_policy&quot; target=&quot;_blank&quot; title=&quot;https://developer.mozilla.org/zh-CN/docs/Web/Security/Same-origin_policy&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;同源策略&lt;/a&gt;决定的，是一个重要的浏览器安全策略，用于限制一个&amp;nbsp;&lt;a href=&quot;https://link.juejin.cn/?target=https%3A%2F%2Fdeveloper.mozilla.org%2Fzh-CN%2Fdocs%2FGlossary%2F%25E6%25BA%2590&quot; target=&quot;_blank&quot; title=&quot;https://developer.mozilla.org/zh-CN/docs/Glossary/%E6%BA%90&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;origin&lt;/a&gt;&amp;nbsp;的文档或者它加载的脚本与另一个源的资源进行交互，它能够帮助阻隔恶意文档，减少可能被攻击的媒介，可以使用&amp;nbsp;&lt;a href=&quot;https://link.juejin.cn/?target=https%3A%2F%2Fdeveloper.mozilla.org%2Fzh-CN%2Fdocs%2FGlossary%2FCORS&quot; target=&quot;_blank&quot; title=&quot;https://developer.mozilla.org/zh-CN/docs/Glossary/CORS&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;CORS&lt;/a&gt;&amp;nbsp;配置解除这个限制。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;关于跨域网上已经有很多解释，这里就不啰嗦，也可以直接看 MDN 的&amp;nbsp;&lt;a href=&quot;https://link.juejin.cn/?target=https%3A%2F%2Fdeveloper.mozilla.org%2Fzh-CN%2Fdocs%2FWeb%2FSecurity%2FSame-origin_policy&quot; target=&quot;_blank&quot; title=&quot;https://developer.mozilla.org/zh-CN/docs/Web/Security/Same-origin_policy&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;&amp;lt;浏览器的同源策略&amp;gt;&lt;/a&gt;&amp;nbsp;文档进一步了解，这里就列举几个同源和不同元的例子，相信程序员都能看得懂。&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码#&amp;nbsp;同源的例子&amp;nbsp;http://example.com/app1/index.html&amp;nbsp;&amp;nbsp;#&amp;nbsp;只是路径不同&amp;nbsp;http://example.com/app2/index.html&amp;nbsp;&amp;nbsp;http://Example.com:80&amp;nbsp;&amp;nbsp;#&amp;nbsp;只是大小写差异&amp;nbsp;http://example.com&amp;nbsp;&amp;nbsp;#&amp;nbsp;不同源的例子&amp;nbsp;http://example.com/app1&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;协议不同&amp;nbsp;https://example.com/app2&amp;nbsp;&amp;nbsp;http://example.com&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;host&amp;nbsp;不同&amp;nbsp;http://www.example.com&amp;nbsp;http://myapp.example.com&amp;nbsp;&amp;nbsp;http://example.com&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;端口不同&amp;nbsp;http://example.com:8080&lt;/pre&gt;&lt;h3 data-id=&quot;heading-4&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;2.3 正向代理和反向代理&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;反向代理（Reverse Proxy）对应的是正向代理（Forward Proxy），他们的区别：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;正向代理：&lt;/span&gt;&amp;nbsp;一般的访问流程是客户端直接向目标服务器发送请求并获取内容，使用正向代理后，客户端改为向代理服务器发送请求，并指定目标服务器（原始服务器），然后由代理服务器和原始服务器通信，转交请求并获得的内容，再返回给客户端。正向代理隐藏了真实的客户端，为客户端收发请求，使真实客户端对服务器不可见；&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;举个具体的例子 🌰，你的浏览器无法直接访问谷哥，这时候可以通过一个代理服务器来帮助你访问谷哥，那么这个服务器就叫正向代理。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;反向代理：&lt;/span&gt;&amp;nbsp;与一般访问流程相比，使用反向代理后，直接收到请求的服务器是代理服务器，然后将请求转发给内部网络上真正进行处理的服务器，得到的结果返回给客户端。反向代理隐藏了真实的服务器，为服务器收发请求，使真实服务器对客户端不可见。一般在处理跨域请求的时候比较常用。现在基本上所有的大型网站都设置了反向代理。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;举个具体的例子 🌰，去饭店吃饭，可以点川菜、粤菜、江浙菜，饭店也分别有三个菜系的厨师 👨‍🍳，但是你作为顾客不用管哪个厨师给你做的菜，只用点菜即可，小二将你菜单中的菜分配给不同的厨师来具体处理，那么这个小二就是反向代理服务器。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;简单的说，一般给客户端做代理的都是正向代理，给服务器做代理的就是反向代理。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;正向代理和反向代理主要的原理区别可以参见下图：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96d99eecdc~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;正向代理与反向代理&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;h3 data-id=&quot;heading-5&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;2.4 负载均衡&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;一般情况下，客户端发送多个请求到服务器，服务器处理请求，其中一部分可能要操作一些资源比如数据库、静态资源等，服务器处理完毕后，再将结果返回给客户端。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这种模式对于早期的系统来说，功能要求不复杂，且并发请求相对较少的情况下还能胜任，成本也低。随着信息数量不断增长，访问量和数据量飞速增长，以及系统业务复杂度持续增加，这种做法已无法满足要求，并发量特别大时，服务器容易崩。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;很明显这是由于服务器性能的瓶颈造成的问题，除了堆机器之外，最重要的做法就是负载均衡。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;请求爆发式增长的情况下，单个机器性能再强劲也无法满足要求了，这个时候集群的概念产生了，单个服务器解决不了的问题，可以使用多个服务器，然后将请求分发到各个服务器上，将负载分发到不同的服务器，这就是&lt;span style=&quot;font-weight: 700&quot;&gt;负载均衡&lt;/span&gt;，核心是「分摊压力」。Nginx 实现负载均衡，一般来说指的是将请求转发给服务器集群。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;举个具体的例子 🌰，晚高峰乘坐地铁的时候，入站口经常会有地铁工作人员大喇叭“请走 B 口，B 口人少车空....”，这个工作人员的作用就是负载均衡。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://cdn.jsdelivr.net/gh/SHERlocked93/pic@env/uPic/2020-03-09-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1.png&quot; alt=&quot;负载均衡&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;h3 data-id=&quot;heading-6&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;2.5 动静分离&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;为了加快网站的解析速度，可以把动态页面和静态页面由不同的服务器来解析，加快解析速度，降低原来单个服务器的压力。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://cdn.jsdelivr.net/gh/SHERlocked93/pic@env/uPic/2020-03-09-%E5%8A%A8%E9%9D%99%E5%88%86%E7%A6%BB.png&quot; alt=&quot;动静分离&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;一般来说，都需要将动态资源和静态资源分开，由于 Nginx 的高并发和静态资源缓存等特性，经常将静态资源部署在 Nginx 上。如果请求的是静态资源，直接到静态资源目录获取资源，如果是动态资源的请求，则利用反向代理的原理，把请求转发给对应后台应用去处理，从而实现动静分离。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;使用前后端分离后，可以很大程度提升静态资源的访问速度，即使动态服务不可用，静态资源的访问也不会受到影响。&lt;/p&gt;&lt;h2 data-id=&quot;heading-7&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;3. Nginx 快速安装&lt;/h2&gt;&lt;h3 data-id=&quot;heading-8&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;3.1 安装&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;我们可以先看看&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码yum&amp;nbsp;list&amp;nbsp;|&amp;nbsp;grep&amp;nbsp;nginx&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;来看看&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e967ad35156~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200307180412726&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码yum&amp;nbsp;install&amp;nbsp;nginx&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;来安装 Nginx，然后我们在命令行中&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -v&lt;/code&gt;&amp;nbsp;就可以看到具体的 Nginx 版本信息，也就安装完毕了。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e967cd99d22~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200307180545816&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;h3 data-id=&quot;heading-9&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;3.2 相关文件夹&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后我们可以使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;rpm -ql nginx&lt;/code&gt;&amp;nbsp;来查看 Nginx 被安装到了什么地方，有哪些相关目录，其中位于&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc&lt;/code&gt;&amp;nbsp;目录下的主要是配置文件，还有一些文件见下图：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e969c75753f~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;Xnip2020-03-07_21-46-11&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;主要关注的文件夹有两个：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d/&lt;/code&gt;&amp;nbsp;文件夹，是我们进行子配置的配置项存放处，&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/nginx.conf&lt;/code&gt;&amp;nbsp;主配置文件会默认把这个文件夹中所有子配置项都引入；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/usr/share/nginx/html/&lt;/code&gt;&amp;nbsp;文件夹，通常静态文件都放在这个文件夹，也可以根据你自己的习惯放其他地方；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h3 data-id=&quot;heading-10&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;3.3 跑起来康康&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;安装之后开启 Nginx，如果系统开启了防火墙，那么需要设置一下在防火墙中加入需要开放的端口，下面列举几个常用的防火墙操作（没开启的话不用管这个）：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码systemctl&amp;nbsp;start&amp;nbsp;firewalld&amp;nbsp;&amp;nbsp;#&amp;nbsp;开启防火墙&amp;nbsp;systemctl&amp;nbsp;stop&amp;nbsp;firewalld&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;关闭防火墙&amp;nbsp;systemctl&amp;nbsp;status&amp;nbsp;firewalld&amp;nbsp;#&amp;nbsp;查看防火墙开启状态，显示running则是正在运行&amp;nbsp;firewall-cmd&amp;nbsp;--reload&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;重启防火墙，永久打开端口需要reload一下&amp;nbsp;&amp;nbsp;#&amp;nbsp;添加开启端口，--permanent表示永久打开，不加是临时打开重启之后失效&amp;nbsp;firewall-cmd&amp;nbsp;--permanent&amp;nbsp;--zone=public&amp;nbsp;--add-port=8888/tcp&amp;nbsp;&amp;nbsp;#&amp;nbsp;查看防火墙，添加的端口也可以看到&amp;nbsp;firewall-cmd&amp;nbsp;--list-all&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后设置 Nginx 的开机启动：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码systemctl&amp;nbsp;enable&amp;nbsp;nginx&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;启动 Nginx （其他命令后面有详细讲解）：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码systemctl&amp;nbsp;start&amp;nbsp;nginx&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后访问你的 IP，这时候就可以看到 Nginx 的欢迎页面了～&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Welcome to nginx！&lt;/code&gt;&amp;nbsp;👏&lt;/p&gt;&lt;h3 data-id=&quot;heading-11&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;3.4 安装 nvm &amp;amp; node &amp;amp; git&lt;/h3&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码#&amp;nbsp;下载&amp;nbsp;nvm，或者看官网的步骤&amp;nbsp;https://github.com/nvm-sh/nvm#install--update-script&amp;nbsp;curl&amp;nbsp;-o-&amp;nbsp;https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh&amp;nbsp;|&amp;nbsp;bash&amp;nbsp;&amp;nbsp;source&amp;nbsp;&amp;nbsp;&amp;nbsp;~/.bashrc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;安装完毕后，更新配置文件即可使用&amp;nbsp;nvm&amp;nbsp;命令&amp;nbsp;nvm&amp;nbsp;ls-remote&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;查看远程&amp;nbsp;node&amp;nbsp;版本&amp;nbsp;nvm&amp;nbsp;install&amp;nbsp;v12.16.3&amp;nbsp;&amp;nbsp;#&amp;nbsp;选一个你要安装的版本安装，我这里选择&amp;nbsp;12.16.3&amp;nbsp;nvm&amp;nbsp;list&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;安装完毕查看安装的&amp;nbsp;node&amp;nbsp;版本&amp;nbsp;node&amp;nbsp;-v&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;查看是否安装好了&amp;nbsp;&amp;nbsp;yum&amp;nbsp;install&amp;nbsp;git&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;git&amp;nbsp;安装&lt;/pre&gt;&lt;h2 data-id=&quot;heading-12&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;4. Nginx 操作常用命令&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 的命令在控制台中输入&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -h&lt;/code&gt;&amp;nbsp;就可以看到完整的命令，这里列举几个常用的命令：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码nginx&amp;nbsp;-s&amp;nbsp;reload&amp;nbsp;&amp;nbsp;#&amp;nbsp;向主进程发送信号，重新加载配置文件，热重启&amp;nbsp;nginx&amp;nbsp;-s&amp;nbsp;reopen&amp;nbsp;&amp;nbsp;#&amp;nbsp;重启&amp;nbsp;Nginx&amp;nbsp;nginx&amp;nbsp;-s&amp;nbsp;stop&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;快速关闭&amp;nbsp;nginx&amp;nbsp;-s&amp;nbsp;quit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;等待工作进程处理完成后关闭&amp;nbsp;nginx&amp;nbsp;-T&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;查看当前&amp;nbsp;Nginx&amp;nbsp;最终的配置&amp;nbsp;nginx&amp;nbsp;-t&amp;nbsp;-c&amp;nbsp;&amp;lt;配置路径&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;检查配置是否有问题，如果已经在配置目录，则不需要-c&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;systemctl&lt;/code&gt;&amp;nbsp;是 Linux 系统应用管理工具&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;systemd&lt;/code&gt;&amp;nbsp;的主命令，用于管理系统，我们也可以用它来对 Nginx 进行管理，相关命令如下：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码systemctl&amp;nbsp;start&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;启动&amp;nbsp;Nginx&amp;nbsp;systemctl&amp;nbsp;stop&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;停止&amp;nbsp;Nginx&amp;nbsp;systemctl&amp;nbsp;restart&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;#&amp;nbsp;重启&amp;nbsp;Nginx&amp;nbsp;systemctl&amp;nbsp;reload&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;重新加载&amp;nbsp;Nginx，用于修改配置后&amp;nbsp;systemctl&amp;nbsp;enable&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;设置开机启动&amp;nbsp;Nginx&amp;nbsp;systemctl&amp;nbsp;disable&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;#&amp;nbsp;关闭开机启动&amp;nbsp;Nginx&amp;nbsp;systemctl&amp;nbsp;status&amp;nbsp;nginx&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;查看&amp;nbsp;Nginx&amp;nbsp;运行状态&lt;/pre&gt;&lt;h2 data-id=&quot;heading-13&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;5. Nginx 配置语法&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;就跟前面文件作用讲解的图所示，Nginx 的主配置文件是&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/nginx.conf&lt;/code&gt;，你可以使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;cat -n nginx.conf&lt;/code&gt;&amp;nbsp;来查看配置。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx.conf&lt;/code&gt;&amp;nbsp;结构图可以这样概括：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码main&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;全局配置，对全局生效&amp;nbsp;├──&amp;nbsp;events&amp;nbsp;&amp;nbsp;#&amp;nbsp;配置影响&amp;nbsp;Nginx&amp;nbsp;服务器或与用户的网络连接&amp;nbsp;├──&amp;nbsp;http&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;配置代理，缓存，日志定义等绝大多数功能和第三方模块的配置&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;├──&amp;nbsp;upstream&amp;nbsp;#&amp;nbsp;配置后端服务器具体地址，负载均衡配置不可或缺的部分&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;├──&amp;nbsp;server&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;配置虚拟主机的相关参数，一个&amp;nbsp;http&amp;nbsp;块中可以有多个&amp;nbsp;server&amp;nbsp;块&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;├──&amp;nbsp;server&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;├──&amp;nbsp;location&amp;nbsp;&amp;nbsp;#&amp;nbsp;server&amp;nbsp;块可以包含多个&amp;nbsp;location&amp;nbsp;块，location&amp;nbsp;指令用于匹配&amp;nbsp;uri&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;├──&amp;nbsp;location&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;└──&amp;nbsp;...&amp;nbsp;│&amp;nbsp;&amp;nbsp;&amp;nbsp;└──&amp;nbsp;...&amp;nbsp;└──&amp;nbsp;...&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;一个 Nginx 配置文件的结构就像&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx.conf&lt;/code&gt;&amp;nbsp;显示的那样，配置文件的语法规则：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;配置文件由指令与指令块构成；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;每条指令以&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;;&lt;/code&gt;&amp;nbsp;分号结尾，指令与参数间以空格符号分隔；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;指令块以&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;{}&lt;/code&gt;&amp;nbsp;大括号将多条指令组织在一起；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;include&lt;/code&gt;&amp;nbsp;语句允许组合多个配置文件以提升可维护性；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;#&lt;/code&gt;&amp;nbsp;符号添加注释，提高可读性；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$&lt;/code&gt;&amp;nbsp;符号使用变量；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;部分指令的参数支持正则表达式；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h3 data-id=&quot;heading-14&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;5.1 典型配置&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 的典型配置：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码user&amp;nbsp;&amp;nbsp;nginx;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;运行用户，默认即是nginx，可以不进行设置&amp;nbsp;worker_processes&amp;nbsp;&amp;nbsp;1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;Nginx&amp;nbsp;进程数，一般设置为和&amp;nbsp;CPU&amp;nbsp;核数一样&amp;nbsp;error_log&amp;nbsp;&amp;nbsp;/var/log/nginx/error.log&amp;nbsp;warn;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;Nginx&amp;nbsp;的错误日志存放目录&amp;nbsp;pid&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/var/run/nginx.pid;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;Nginx&amp;nbsp;服务启动时的&amp;nbsp;pid&amp;nbsp;存放位置&amp;nbsp;&amp;nbsp;events&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;use&amp;nbsp;epoll;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;使用epoll的I/O模型(如果你不知道Nginx该使用哪种轮询方法，会自动选择一个最适合你操作系统的)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;worker_connections&amp;nbsp;1024;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;每个进程允许最大并发数&amp;nbsp;}&amp;nbsp;&amp;nbsp;http&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;配置使用最频繁的部分，代理、缓存、日志定义等绝大多数功能和第三方模块的配置都在这里设置&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;设置日志模式&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;log_format&amp;nbsp;&amp;nbsp;main&amp;nbsp;&amp;nbsp;&amp;#39;$remote_addr&amp;nbsp;-&amp;nbsp;$remote_user&amp;nbsp;[$time_local]&amp;nbsp;&amp;quot;$request&amp;quot;&amp;nbsp;&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;$status&amp;nbsp;$body_bytes_sent&amp;nbsp;&amp;quot;$http_referer&amp;quot;&amp;nbsp;&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;&amp;quot;$http_user_agent&amp;quot;&amp;nbsp;&amp;quot;$http_x_forwarded_for&amp;quot;&amp;#39;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;access_log&amp;nbsp;&amp;nbsp;/var/log/nginx/access.log&amp;nbsp;&amp;nbsp;main;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;Nginx访问日志存放位置&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sendfile&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;开启高效传输模式&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tcp_nopush&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;减少网络报文段的数量&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tcp_nodelay&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;keepalive_timeout&amp;nbsp;&amp;nbsp;&amp;nbsp;65;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;保持连接的时间，也叫超时时间，单位秒&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;types_hash_max_size&amp;nbsp;2048;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;include&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/etc/nginx/mime.types;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;文件扩展名与类型映射表&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default_type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;application/octet-stream;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;默认文件类型&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;include&amp;nbsp;/etc/nginx/conf.d/*.conf;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;加载子配置项&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;配置监听的端口&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;&amp;nbsp;localhost;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;配置的域名&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;&amp;nbsp;/usr/share/nginx/html;&amp;nbsp;&amp;nbsp;#&amp;nbsp;网站根目录&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;&amp;nbsp;index.html&amp;nbsp;index.htm;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;默认首页文件&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;deny&amp;nbsp;172.168.22.11;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;禁止访问的ip地址，可以为all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;allow&amp;nbsp;172.168.33.44；&amp;nbsp;#&amp;nbsp;允许访问的ip地址，可以为all&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error_page&amp;nbsp;500&amp;nbsp;502&amp;nbsp;503&amp;nbsp;504&amp;nbsp;/50x.html;&amp;nbsp;&amp;nbsp;#&amp;nbsp;默认50x对应的访问页面&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;error_page&amp;nbsp;400&amp;nbsp;404&amp;nbsp;error.html;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;同上&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;server 块可以包含多个 location 块，location 指令用于匹配 uri，语法：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码location&amp;nbsp;[&amp;nbsp;=&amp;nbsp;|&amp;nbsp;~&amp;nbsp;|&amp;nbsp;~*&amp;nbsp;|&amp;nbsp;^~]&amp;nbsp;uri&amp;nbsp;{&amp;nbsp;&amp;nbsp;...&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;指令后面：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;=&lt;/code&gt;&amp;nbsp;精确匹配路径，用于不含正则表达式的 uri 前，如果匹配成功，不再进行后续的查找；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;^~&lt;/code&gt;&amp;nbsp;用于不含正则表达式的 uri； 前，表示如果该符号后面的字符是最佳匹配，采用该规则，不再进行后续的查找；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;~&lt;/code&gt;&amp;nbsp;表示用该符号后面的正则去匹配路径，区分大小写；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;~*&lt;/code&gt;&amp;nbsp;表示用该符号后面的正则去匹配路径，不区分大小写。跟&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;~&lt;/code&gt;&amp;nbsp;优先级都比较低，如有多个location的正则能匹配的话，则使用正则表达式最长的那个；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;如果 uri 包含正则表达式，则必须要有&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;~&lt;/code&gt;&amp;nbsp;或&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;~*&lt;/code&gt;&amp;nbsp;标志。&lt;/p&gt;&lt;h3 data-id=&quot;heading-15&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;5.2 全局变量&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 有一些常用的全局变量，你可以在配置的任何位置使用它们，如下表：&lt;/p&gt;&lt;table width=&quot;NaN&quot;&gt;&lt;thead style=&quot;background: rgb(246, 246, 246);color: rgb(0, 0, 0)&quot;&gt;&lt;tr class=&quot;firstRow&quot;&gt;&lt;th style=&quot;padding: 12px 7px;line-height: 24px&quot;&gt;全局变量名&lt;/th&gt;&lt;th style=&quot;padding: 12px 7px;line-height: 24px&quot;&gt;功能&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$host&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;请求信息中的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Host&lt;/code&gt;，如果请求中没有&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Host&lt;/code&gt;&amp;nbsp;行，则等于设置的服务器名，不包含端口&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$request_method&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端请求类型，如&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;GET&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;POST&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$remote_addr&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;IP&lt;/code&gt;&amp;nbsp;地址&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$args&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;请求中的参数&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$arg_PARAMETER&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;GET&lt;/code&gt;&amp;nbsp;请求中变量名 PARAMETER 参数的值，例如：&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$http_user_agent&lt;/code&gt;(Uaer-Agent 值),&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$http_referer&lt;/code&gt;...&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$content_length&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;请求头中的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Content-length&lt;/code&gt;&amp;nbsp;字段&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$http_user_agent&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端agent信息&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$http_cookie&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端cookie信息&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$remote_addr&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端的IP地址&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$remote_port&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端的端口&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$http_user_agent&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;客户端agent信息&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$server_protocol&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;请求使用的协议，如&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;HTTP/1.0&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;HTTP/1.1&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$server_addr&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;服务器地址&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$server_name&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;服务器名称&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$server_port&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;服务器的端口号&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;background-color: rgb(252, 252, 252)&quot;&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$scheme&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;padding: 12px 7px;line-height: 24px;min-width: 120px&quot;&gt;HTTP 方法（如http，https）&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;还有更多的内置预定义变量，可以直接搜索关键字「nginx内置预定义变量」可以看到一堆博客写这个，这些变量都可以在配置文件中直接使用。&lt;/p&gt;&lt;h2 data-id=&quot;heading-16&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;6. 设置二级域名虚拟主机&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;在某某云 ☁️ 上购买了域名之后，就可以配置虚拟主机了，一般配置的路径在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;域名管理 -&amp;gt; 解析 -&amp;gt; 添加记录&lt;/code&gt;&amp;nbsp;中添加二级域名，配置后某某云会把二级域名也解析到我们配置的服务器 IP 上，然后我们在 Nginx 上配置一下虚拟主机的访问监听，就可以拿到从这个二级域名过来的请求了。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96a168c66a~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200426150644768&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;现在我自己的服务器上配置了一个 fe 的二级域名，也就是说在外网访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;的时候，也可以访问到我们的服务器了。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;由于默认配置文件&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/nginx.conf&lt;/code&gt;&amp;nbsp;的 http 模块中有一句&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;include /etc/nginx/conf.d/*.conf&lt;/code&gt;&amp;nbsp;也就是说&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;conf.d&lt;/code&gt;&amp;nbsp;文件夹下的所有&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;*.conf&lt;/code&gt;&amp;nbsp;文件都会作为子配置项被引入配置文件中。为了维护方便，我在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d&lt;/code&gt;&amp;nbsp;文件夹中新建一个&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club.conf&lt;/code&gt;&amp;nbsp;：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码#&amp;nbsp;/etc/nginx/conf.d/fe.sherlocked93.club.conf&amp;nbsp;&amp;nbsp;server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;80;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;fe.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;/usr/share/nginx/html/fe;&amp;nbsp;&amp;nbsp;index&amp;nbsp;index.html;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/usr/share/nginx/html&lt;/code&gt;&amp;nbsp;文件夹下新建 fe 文件夹，新建文件&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;index.html&lt;/code&gt;，内容随便写点，改完&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -s reload&lt;/code&gt;&amp;nbsp;重新加载，浏览器中输入&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;，发现从二级域名就可以访问到我们刚刚新建的 fe 文件夹：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96a60a5e51~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200426153006505&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;h2 data-id=&quot;heading-17&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;7. 配置反向代理&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;反向代理是工作中最常用的服务器功能，经常被用来解决跨域问题，下面简单介绍一下如何实现反向代理。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;首先进入 Nginx 的主配置文件：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码vim&amp;nbsp;/etc/nginx/nginx.conf&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;为了看起来方便，把行号显示出来&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;:set nu&lt;/code&gt;&amp;nbsp;（个人习惯），然后我们去&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http&lt;/code&gt;&amp;nbsp;模块的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;server&lt;/code&gt;&amp;nbsp;块中的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;location /&lt;/code&gt;，增加一行将默认网址重定向到最大学习网站 Bilibili 的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;proxy_pass&lt;/code&gt;&amp;nbsp;配置 🤓 ：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96a6d7033c~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200311153131642&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;改完保存退出，&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -s reload&lt;/code&gt;&amp;nbsp;重新加载，进入默认网址，那么现在就直接跳转到 B 站了，实现了一个简单的代理。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;实际使用中，可以将请求转发到本机另一个服务器上，也可以根据访问的路径跳转到不同端口的服务中。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;比如我们监听&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;9001&lt;/code&gt;&amp;nbsp;端口，然后把访问不同路径的请求进行反向代理：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;把访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http://127.0.0.1:9001/edu&lt;/code&gt;&amp;nbsp;的请求转发到&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http://127.0.0.1:8080&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;把访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http://127.0.0.1:9001/vod&lt;/code&gt;&amp;nbsp;的请求转发到&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http://127.0.0.1:8081&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这种要怎么配置呢，首先同样打开主配置文件，然后在 http 模块下增加一个 server 块：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;9001;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;*.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;~&amp;nbsp;/edu/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;http://127.0.0.1:8080;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;~&amp;nbsp;/vod/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;http://127.0.0.1:8081;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;反向代理还有一些其他的指令，可以了解一下：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;proxy_set_header&lt;/code&gt;：在将客户端请求发送给后端服务器之前，更改来自客户端的请求头信息。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;proxy_connect_timeout&lt;/code&gt;：配置Nginx与后端代理服务器尝试建立连接的超时时间。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;proxy_read_timeout&lt;/code&gt;：配置Nginx向后端服务器组发出read请求后，等待相应的超时时间。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;proxy_send_timeout&lt;/code&gt;：配置Nginx向后端服务器组发出write请求后，等待相应的超时时间。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;proxy_redirect&lt;/code&gt;：用于修改后端服务器返回的响应头中的Location和Refresh。&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2 data-id=&quot;heading-18&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;8. 跨域 CORS 配置&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;关于简单请求、非简单请求、跨域的概念，前面已经介绍过了，还不了解的可以看看前面的讲解。现在前后端分离的项目一统天下，经常本地起了前端服务，需要访问不同的后端地址，不可避免遇到跨域问题。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96b16214cc~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200427220536208&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;要解决跨域问题，我们来制造一个跨域问题。首先和前面设置二级域名的方式一样，先设置好&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;和&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club&lt;/code&gt;&amp;nbsp;二级域名，都指向本云服务器地址，虽然对应 IP 是一样的，但是在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;域名发出的请求访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club&lt;/code&gt;&amp;nbsp;域名的请求还是跨域了，因为访问的 host 不一致（如果不知道啥原因参见前面跨域的内容）。&lt;/p&gt;&lt;h3 data-id=&quot;heading-19&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;8.1 使用反向代理解决跨域&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;在前端服务地址为&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;的页面请求&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club&lt;/code&gt;&amp;nbsp;的后端服务导致的跨域，可以这样配置：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;9001;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;fe.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;be.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这样就将对前一个域名&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;的请求全都代理到了&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club&lt;/code&gt;，前端的请求都被我们用服务器代理到了后端地址下，绕过了跨域。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这里对静态文件的请求和后端服务的请求都以&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;开始，不易区分，所以为了实现对后端服务请求的统一转发，通常我们会约定对后端服务的请求加上&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/apis/&lt;/code&gt;&amp;nbsp;前缀或者其他的 path 来和对静态资源的请求加以区分，此时我们可以这样配置：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码#&amp;nbsp;请求跨域，约定代理后端服务请求path以/apis/开头&amp;nbsp;location&amp;nbsp;^~/apis/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;这里重写了请求，将正则匹配中的第一个分组的path拼接到真正的请求后面，并用break停止后续匹配&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rewrite&amp;nbsp;^/apis/(.*)$&amp;nbsp;/$1&amp;nbsp;break;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;be.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;两个域名之间cookie的传递与回写&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_cookie_domain&amp;nbsp;be.sherlocked93.club&amp;nbsp;fe.sherlocked93.club;&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这样，静态资源我们使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club/xx.html&lt;/code&gt;，动态资源我们使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club/apis/getAwo&lt;/code&gt;，浏览器页面看起来仍然访问的前端服务器，绕过了浏览器的同源策略，毕竟我们看起来并没有跨域。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;也可以统一一点，直接把前后端服务器地址直接都转发到另一个&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;server.sherlocked93.club&lt;/code&gt;，只通过在后面添加的 path 来区分请求的是静态资源还是后端服务，看需求了。&lt;/p&gt;&lt;h3 data-id=&quot;heading-20&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;8.2 配置 header 解决跨域&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;当浏览器在访问跨源的服务器时，也可以在跨域的服务器上直接设置 Nginx，从而前端就可以无感地开发，不用把实际上访问后端的地址改成前端服务的地址，这样可适性更高。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;比如前端站点是&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;，这个地址下的前端页面请求&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club&lt;/code&gt;&amp;nbsp;下的资源，比如前者的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club/index.html&lt;/code&gt;&amp;nbsp;内容是这样的：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;html代码解读复制代码&amp;lt;html&amp;gt;&amp;nbsp;&amp;lt;body&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;h1&amp;gt;welcome&amp;nbsp;fe.sherlocked93.club!!&amp;lt;h1&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;script&amp;nbsp;type=&amp;#39;text/javascript&amp;#39;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;xmlhttp&amp;nbsp;=&amp;nbsp;new&amp;nbsp;XMLHttpRequest()&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xmlhttp.open(&amp;quot;GET&amp;quot;,&amp;nbsp;&amp;quot;http://be.sherlocked93.club/index.html&amp;quot;,&amp;nbsp;true);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xmlhttp.send();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/script&amp;gt;&amp;nbsp;&amp;lt;/body&amp;gt;&amp;nbsp;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;打开浏览器访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club/index.html&lt;/code&gt;&amp;nbsp;的结果如下：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96b99b44b7~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200428191153736&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;很明显这里是跨域请求，在浏览器中直接访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http://be.sherlocked93.club/index.html&lt;/code&gt;&amp;nbsp;是可以访问到的，但是在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club&lt;/code&gt;&amp;nbsp;的 html 页面访问就会出现跨域。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d/&lt;/code&gt;&amp;nbsp;文件夹中新建一个配置文件，对应二级域名&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club&lt;/code&gt;&amp;nbsp;：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码#&amp;nbsp;/etc/nginx/conf.d/be.sherlocked93.club.conf&amp;nbsp;&amp;nbsp;server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;&amp;nbsp;be.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Access-Control-Allow-Origin&amp;#39;&amp;nbsp;$http_origin;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;全局变量获得当前请求origin，带cookie的请求不支持*&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Access-Control-Allow-Credentials&amp;#39;&amp;nbsp;&amp;#39;true&amp;#39;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;为&amp;nbsp;true&amp;nbsp;可带上&amp;nbsp;cookie&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Access-Control-Allow-Methods&amp;#39;&amp;nbsp;&amp;#39;GET,&amp;nbsp;POST,&amp;nbsp;OPTIONS&amp;#39;;&amp;nbsp;&amp;nbsp;#&amp;nbsp;允许请求方法&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Access-Control-Allow-Headers&amp;#39;&amp;nbsp;$http_access_control_request_headers;&amp;nbsp;&amp;nbsp;#&amp;nbsp;允许请求的&amp;nbsp;header，可以为&amp;nbsp;*&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Access-Control-Expose-Headers&amp;#39;&amp;nbsp;&amp;#39;Content-Length,Content-Range&amp;#39;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;($request_method&amp;nbsp;=&amp;nbsp;&amp;#39;OPTIONS&amp;#39;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Access-Control-Max-Age&amp;#39;&amp;nbsp;1728000;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;OPTIONS&amp;nbsp;请求的有效期，在有效期内不用发出另一条预检请求&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Content-Type&amp;#39;&amp;nbsp;&amp;#39;text/plain;&amp;nbsp;charset=utf-8&amp;#39;;&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;&amp;#39;Content-Length&amp;#39;&amp;nbsp;0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;204;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;200&amp;nbsp;也可以&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;/usr/share/nginx/html/be;&amp;nbsp;&amp;nbsp;index&amp;nbsp;index.html;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -s reload&lt;/code&gt;&amp;nbsp;重新加载配置。这时再访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club/index.html&lt;/code&gt;&amp;nbsp;结果如下，请求中出现了我们刚刚配置的 Header：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96c8e70d22~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200428192028636&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;解决了跨域问题。&lt;/p&gt;&lt;h2 data-id=&quot;heading-21&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;9. 开启 gzip 压缩&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;gzip 是一种常用的网页压缩技术，传输的网页经过 gzip 压缩之后大小通常可以变为原来的一半甚至更小（官网原话），更小的网页体积也就意味着带宽的节约和传输速度的提升，特别是对于访问量巨大大型网站来说，每一个静态资源体积的减小，都会带来可观的流量与带宽的节省。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;百度可以找到很多检测站点来查看目标网页有没有开启 gzip 压缩，在下随便找了一个&amp;nbsp;&lt;a href=&quot;https://link.juejin.cn/?target=http%3A%2F%2Ftool.chinaz.com%2FGzips%2FDefault.aspx%3Fq%3Djuejin.im&quot; target=&quot;_blank&quot; title=&quot;http://tool.chinaz.com/Gzips/Default.aspx?q=juejin.im&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;&amp;lt;网页GZIP压缩检测&amp;gt;&lt;/a&gt;&amp;nbsp;输入掘金&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;juejin.im&lt;/code&gt;&amp;nbsp;来偷窥下掘金有没有开启 gzip。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96dc471f0b~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200427110415809&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这里可以看到掘金是开启了 gzip 的，压缩效果还挺不错，达到了 52% 之多，本来&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;34kb&lt;/code&gt;&amp;nbsp;的网页体积，压缩完只需要&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;16kb&lt;/code&gt;，可以想象网页传输速度提升了不少。&lt;/p&gt;&lt;h3 data-id=&quot;heading-22&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;9.1 Nginx 配置 gzip&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;使用 gzip 不仅需要 Nginx 配置，浏览器端也需要配合，需要在请求消息头中包含&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Accept-Encoding: gzip&lt;/code&gt;（IE5 之后所有的浏览器都支持了，是现代浏览器的默认设置）。一般在请求 html 和 css 等静态资源的时候，支持的浏览器在 request 请求静态资源的时候，会加上&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Accept-Encoding: gzip&lt;/code&gt;&amp;nbsp;这个 header，表示自己支持 gzip 的压缩方式，Nginx 在拿到这个请求的时候，如果有相应配置，就会返回经过 gzip 压缩过的文件给浏览器，并在 response 相应的时候加上&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;content-encoding: gzip&lt;/code&gt;&amp;nbsp;来告诉浏览器自己采用的压缩方式（因为浏览器在传给服务器的时候一般还告诉服务器自己支持好几种压缩方式），浏览器拿到压缩的文件后，根据自己的解压方式进行解析。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;先来看看 Nginx 怎么进行 gzip 配置，和之前的配置一样，为了方便管理，还是在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d/&lt;/code&gt;&amp;nbsp;文件夹中新建配置文件&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;gzip.conf&lt;/code&gt;&amp;nbsp;：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码#&amp;nbsp;/etc/nginx/conf.d/gzip.conf&amp;nbsp;&amp;nbsp;gzip&amp;nbsp;on;&amp;nbsp;#&amp;nbsp;默认off，是否开启gzip&amp;nbsp;gzip_types&amp;nbsp;text/plain&amp;nbsp;text/css&amp;nbsp;application/json&amp;nbsp;application/x-javascript&amp;nbsp;text/xml&amp;nbsp;application/xml&amp;nbsp;application/xml+rss&amp;nbsp;text/javascript;&amp;nbsp;&amp;nbsp;#&amp;nbsp;上面两个开启基本就能跑起了，下面的愿意折腾就了解一下&amp;nbsp;gzip_static&amp;nbsp;on;&amp;nbsp;gzip_proxied&amp;nbsp;any;&amp;nbsp;gzip_vary&amp;nbsp;on;&amp;nbsp;gzip_comp_level&amp;nbsp;6;&amp;nbsp;gzip_buffers&amp;nbsp;16&amp;nbsp;8k;&amp;nbsp;#&amp;nbsp;gzip_min_length&amp;nbsp;1k;&amp;nbsp;gzip_http_version&amp;nbsp;1.1;&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;稍微解释一下：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_types&lt;/span&gt;：要采用 gzip 压缩的 MIME 文件类型，其中 text/html 被系统强制启用；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_static&lt;/span&gt;：默认 off，该模块启用后，Nginx 首先检查是否存在请求静态文件的 gz 结尾的文件，如果有则直接返回该&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;.gz&lt;/code&gt;&amp;nbsp;文件内容；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_proxied&lt;/span&gt;：默认 off，nginx做为反向代理时启用，用于设置启用或禁用从代理服务器上收到相应内容 gzip 压缩；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_vary&lt;/span&gt;：用于在响应消息头中添加&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Vary：Accept-Encoding&lt;/code&gt;，使代理服务器根据请求头中的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Accept-Encoding&lt;/code&gt;&amp;nbsp;识别是否启用 gzip 压缩；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_comp_level&lt;/span&gt;：gzip 压缩比，压缩级别是 1-9，1 压缩级别最低，9 最高，级别越高压缩率越大，压缩时间越长，建议 4-6；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_buffers&lt;/span&gt;：获取多少内存用于缓存压缩结果，16 8k 表示以 8k*16 为单位获得；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_min_length&lt;/span&gt;：允许压缩的页面最小字节数，页面字节数从header头中的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Content-Length&lt;/code&gt;&amp;nbsp;中进行获取。默认值是 0，不管页面多大都压缩。建议设置成大于 1k 的字节数，小于 1k 可能会越压越大；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;gzip_http_version&lt;/span&gt;：默认 1.1，启用 gzip 所需的 HTTP 最低版本；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这个配置可以插入到 http 模块整个服务器的配置里，也可以插入到需要使用的虚拟主机的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;server&lt;/code&gt;&amp;nbsp;或者下面的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;location&lt;/code&gt;&amp;nbsp;模块中，当然像上面我们这样写的话就是被 include 到 http 模块中了。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;其他更全的配置信息可以查看&amp;nbsp;&lt;a href=&quot;https://link.juejin.cn/?target=http%3A%2F%2Fnginx.org%2Fen%2Fdocs%2Fhttp%2Fngx_http_gzip_module.html&quot; target=&quot;_blank&quot; title=&quot;http://nginx.org/en/docs/http/ngx_http_gzip_module.html&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;&amp;lt;官网文档ngx_http_gzip_module&amp;gt;&lt;/a&gt;，配置前是这样的：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96dd2b5019~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200427161022215&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;配置之后 response 的 header 里面多了一个&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;Content-Encoding: gzip&lt;/code&gt;，返回信息被压缩了：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96def4db0f~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200427164033577&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;注意了，一般 gzip 的配置建议加上&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;gzip_min_length 1k&lt;/code&gt;，不加的话：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96ee3279e8~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200427164408389&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;由于文件太小，gzip 压缩之后得到了 -48% 的体积优化，压缩之后体积还比压缩之前体积大了，所以最好设置低于&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;1kb&lt;/code&gt;&amp;nbsp;的文件就不要 gzip 压缩了 🤪&lt;/p&gt;&lt;h3 data-id=&quot;heading-23&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;9.2 Webpack 的 gzip 配置&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;当前端项目使用 Webpack 进行打包的时候，也可以开启 gzip 压缩：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;javascript代码解读复制代码//&amp;nbsp;vue-cli3&amp;nbsp;的&amp;nbsp;vue.config.js&amp;nbsp;文件&amp;nbsp;const&amp;nbsp;CompressionWebpackPlugin&amp;nbsp;=&amp;nbsp;require(&amp;#39;compression-webpack-plugin&amp;#39;)&amp;nbsp;&amp;nbsp;module.exports&amp;nbsp;=&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;gzip&amp;nbsp;配置&amp;nbsp;&amp;nbsp;&amp;nbsp;configureWebpack:&amp;nbsp;config&amp;nbsp;=&amp;gt;&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(process.env.NODE_ENV&amp;nbsp;===&amp;nbsp;&amp;#39;production&amp;#39;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;生产环境&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;plugins:&amp;nbsp;[new&amp;nbsp;CompressionWebpackPlugin({&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;test:&amp;nbsp;/\.js$|\.html$|\.css/,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;匹配文件名&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;threshold:&amp;nbsp;10240,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;文件压缩阈值，对超过10k的进行压缩&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;deleteOriginalAssets:&amp;nbsp;false&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;是否删除源文件&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;})]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;},&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;由此打包出来的文件如下图：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e96f98708c7~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;image-20200427144824829&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这里可以看到某些打包之后的文件下面有一个对应的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;.gz&lt;/code&gt;&amp;nbsp;经过&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;gzip&lt;/code&gt;&amp;nbsp;压缩之后的文件，这是因为这个文件超过了&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;10kb&lt;/code&gt;，有的文件没有超过&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;10kb&lt;/code&gt;&amp;nbsp;就没有进行&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;gzip&lt;/code&gt;&amp;nbsp;打包，如果你期望压缩文件的体积阈值小一点，可以在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;compression-webpack-plugin&lt;/code&gt;&amp;nbsp;这个插件的配置里进行对应配置。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;那么为啥这里 Nginx 已经有了 gzip 压缩，Webpack 这里又整了个 gzip 呢，因为如果全都是使用 Nginx 来压缩文件，会耗费服务器的计算资源，如果服务器的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;gzip_comp_level&lt;/code&gt;&amp;nbsp;配置的比较高，就更增加服务器的开销，相应增加客户端的请求时间，得不偿失。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;如果压缩的动作在前端打包的时候就做了，把打包之后的高压缩等级文件作为静态资源放在服务器上，Nginx 会优先查找这些压缩之后的文件返回给客户端，相当于把压缩文件的动作从 Nginx 提前给 Webpack 打包的时候完成，节约了服务器资源，所以一般推介在生产环境应用 Webpack 配置 gzip 压缩。&lt;/p&gt;&lt;h2 data-id=&quot;heading-24&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;10. 配置负载均衡&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;负载均衡在之前已经介绍了相关概念了，主要思想就是把负载均匀合理地分发到多个服务器上，实现压力分流的目的。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;主要配置如下：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码http&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;upstream&amp;nbsp;myserver&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;ip_hash;&amp;nbsp;&amp;nbsp;#&amp;nbsp;ip_hash&amp;nbsp;方式&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;fair;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;fair&amp;nbsp;方式&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;127.0.0.1:8081;&amp;nbsp;&amp;nbsp;#&amp;nbsp;负载均衡目的服务地址&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;127.0.0.1:8080;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;127.0.0.1:8082&amp;nbsp;weight=10;&amp;nbsp;&amp;nbsp;#&amp;nbsp;weight&amp;nbsp;方式，不写默认为&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;http://myserver;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_connect_timeout&amp;nbsp;10;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;Nginx 提供了好几种分配方式，默认为&lt;span style=&quot;font-weight: 700&quot;&gt;轮询&lt;/span&gt;，就是轮流来。有以下几种分配方式：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;轮询&lt;/span&gt;，默认方式，每个请求按时间顺序逐一分配到不同的后端服务器，如果后端服务挂了，能自动剔除；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;weight&lt;/span&gt;，权重分配，指定轮询几率，权重越高，在被访问的概率越大，用于后端服务器性能不均的情况；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;ip_hash&lt;/span&gt;，每个请求按访问 IP 的 hash 结果分配，这样每个访客固定访问一个后端服务器，可以解决动态网页 session 共享问题。负载均衡每次请求都会重新定位到服务器集群中的某一个，那么已经登录某一个服务器的用户再重新定位到另一个服务器，其登录信息将会丢失，这样显然是不妥的；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;font-weight: 700&quot;&gt;fair&lt;/span&gt;（第三方），按后端服务器的响应时间分配，响应时间短的优先分配，依赖第三方插件 nginx-upstream-fair，需要先安装；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;h2 data-id=&quot;heading-25&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;11. 配置动静分离&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;动静分离在之前也介绍过了，就是把动态和静态的请求分开。方式主要有两种，一种 是纯粹把静态文件独立成单独的域名，放在独立的服务器上，也是目前主流推崇的方案。另外一种方法就是动态跟静态文件混合在一起发布， 通过 Nginx 配置来分开。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;通过 location 指定不同的后缀名实现不同的请求转发。通过 expires 参数设置，可以使浏览器缓存过期时间，减少与服务器之前的请求和流量。具体 expires 定义：是给一个资源设定一个过期时间，也就是说无需去服务端验证，直接通过浏览器自身确认是否过期即可，所以不会产生额外的流量。此种方法非常适合不经常变动的资源。（如果经常更新的文件，不建议使用 expires 来缓存），我这里设置 3d，表示在这 3 天之内访问这个URL，发送一个请求，比对服务器该文件最后更新时间没有变化。则不会从服务器抓取，返回状态码 304，如果有修改，则直接从服务器重新下载，返回状态码 200。&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/www/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;/data/;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;index.html&amp;nbsp;index.htm;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/image/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;/data/;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;autoindex&amp;nbsp;on;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;h2 data-id=&quot;heading-26&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;12. 配置高可用集群（双机热备）&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;当主 Nginx 服务器宕机之后，切换到备份 Nginx 服务器&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://cdn.jsdelivr.net/gh/SHERlocked93/pic@env/uPic/2020-03-13-%E5%8F%8C%E6%9C%BA%E7%83%AD%E5%A4%87%20%281%29.png&quot; alt=&quot;2020-03-13-双机热备&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;首先安装 keepalived，&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码yum&amp;nbsp;install&amp;nbsp;keepalived&amp;nbsp;-y&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后编辑&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/keepalived/keepalived.conf&lt;/code&gt;&amp;nbsp;配置文件，并在配置文件中增加&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;vrrp_script&lt;/code&gt;&amp;nbsp;定义一个外围检测机制，并在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;vrrp_instance&lt;/code&gt;&amp;nbsp;中通过定义&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;track_script&lt;/code&gt;&amp;nbsp;来追踪脚本执行过程，实现节点转移：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;json代码解读复制代码global_defs{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;notification_email&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;acassen@firewall.loc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;notification_email_from&amp;nbsp;Alexandre@firewall.loc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;smtp_server&amp;nbsp;127.0.0.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;smtp_connect_timeout&amp;nbsp;30&amp;nbsp;//&amp;nbsp;上面都是邮件配置，没卵用&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;router_id&amp;nbsp;LVS_DEVEL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;当前服务器名字，用hostname命令来查看&amp;nbsp;}&amp;nbsp;vrrp_script&amp;nbsp;chk_maintainace&amp;nbsp;{&amp;nbsp;//&amp;nbsp;检测机制的脚本名称为chk_maintainace&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;script&amp;nbsp;&amp;quot;[[&amp;nbsp;-e/etc/keepalived/down&amp;nbsp;]]&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;exit&amp;nbsp;1&amp;nbsp;||&amp;nbsp;exit&amp;nbsp;0&amp;quot;&amp;nbsp;//&amp;nbsp;可以是脚本路径或脚本命令&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;script&amp;nbsp;&amp;quot;/etc/keepalived/nginx_check.sh&amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;比如这样的脚本路径&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;interval&amp;nbsp;2&amp;nbsp;&amp;nbsp;//&amp;nbsp;每隔2秒检测一次&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;weight&amp;nbsp;-20&amp;nbsp;&amp;nbsp;//&amp;nbsp;当脚本执行成立，那么把当前服务器优先级改为-20&amp;nbsp;}&amp;nbsp;vrrp_instanceVI_1&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;每一个vrrp_instance就是定义一个虚拟路由器&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;state&amp;nbsp;MASTER&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;主机为MASTER，备用机为BACKUP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;interface&amp;nbsp;eth0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;网卡名字，可以从ifconfig中查找&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;virtual_router_id&amp;nbsp;51&amp;nbsp;//&amp;nbsp;虚拟路由的id号，一般小于255，主备机id需要一样&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;priority&amp;nbsp;100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;优先级，master的优先级比backup的大&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;advert_int&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;默认心跳间隔&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;authentication&amp;nbsp;{&amp;nbsp;&amp;nbsp;//&amp;nbsp;认证机制&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;auth_type&amp;nbsp;PASS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;auth_pass&amp;nbsp;1111&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;密码&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;virtual_ipaddress&amp;nbsp;{&amp;nbsp;&amp;nbsp;//&amp;nbsp;虚拟地址vip&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;172.16.2.8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;其中检测脚本&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx_check.sh&lt;/code&gt;，这里提供一个：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;sh代码解读复制代码#!/bin/bash&amp;nbsp;A=`ps&amp;nbsp;-C&amp;nbsp;nginx&amp;nbsp;--no-header&amp;nbsp;|&amp;nbsp;wc&amp;nbsp;-l`&amp;nbsp;if&amp;nbsp;[&amp;nbsp;$A&amp;nbsp;-eq&amp;nbsp;0&amp;nbsp;];then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/usr/sbin/nginx&amp;nbsp;#&amp;nbsp;尝试重新启动nginx&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sleep&amp;nbsp;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;睡眠2秒&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;[&amp;nbsp;`ps&amp;nbsp;-C&amp;nbsp;nginx&amp;nbsp;--no-header&amp;nbsp;|&amp;nbsp;wc&amp;nbsp;-l`&amp;nbsp;-eq&amp;nbsp;0&amp;nbsp;];then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;killall&amp;nbsp;keepalived&amp;nbsp;#&amp;nbsp;启动失败，将keepalived服务杀死。将vip漂移到其它备份节点&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fi&amp;nbsp;fi&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;复制一份到备份服务器，备份 Nginx 的配置要将&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;state&lt;/code&gt;&amp;nbsp;后改为&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;BACKUP&lt;/code&gt;，&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;priority&lt;/code&gt;&amp;nbsp;改为比主机小。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;设置完毕后各自&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;service keepalived start&lt;/code&gt;&amp;nbsp;启动，经过访问成功之后，可以把 Master 机的 keepalived 停掉，此时 Master 机就不再是主机了&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;service keepalived stop&lt;/code&gt;，看访问虚拟 IP 时是否能够自动切换到备机&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;ip addr&lt;/code&gt;。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;再次启动 Master 的 keepalived，此时 vip 又变到了主机上。&lt;/p&gt;&lt;h2 data-id=&quot;heading-27&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;13. 适配 PC 或移动设备&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;根据用户设备不同返回不同样式的站点，以前经常使用的是纯前端的自适应布局，但无论是复杂性和易用性上面还是不如分开编写的好，比如我们常见的淘宝、京东......这些大型网站就都没有采用自适应，而是用分开制作的方式，根据用户请求的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;user-agent&lt;/code&gt;&amp;nbsp;来判断是返回 PC 还是 H5 站点。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;首先在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/usr/share/nginx/html&lt;/code&gt;&amp;nbsp;文件夹下&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;mkdir&lt;/code&gt;&amp;nbsp;分别新建两个文件夹&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;PC&lt;/code&gt;&amp;nbsp;和&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;mobile&lt;/code&gt;，&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;vim&lt;/code&gt;&amp;nbsp;编辑两个&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;index.html&lt;/code&gt;&amp;nbsp;随便写点内容。&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码cd&amp;nbsp;/usr/share/nginx/html&amp;nbsp;mkdir&amp;nbsp;pc&amp;nbsp;mobile&amp;nbsp;cd&amp;nbsp;pc&amp;nbsp;vim&amp;nbsp;index.html&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;随便写点比如&amp;nbsp;hello&amp;nbsp;pc!&amp;nbsp;cd&amp;nbsp;../mobile&amp;nbsp;vim&amp;nbsp;index.html&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;随便写点比如&amp;nbsp;hello&amp;nbsp;mobile!&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;然后和设置二级域名虚拟主机时候一样，去&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d&lt;/code&gt;&amp;nbsp;文件夹下新建一个配置文件&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club.conf&lt;/code&gt;&amp;nbsp;：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码#&amp;nbsp;/etc/nginx/conf.d/fe.sherlocked93.club.conf&amp;nbsp;&amp;nbsp;server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;80;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;fe.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;/usr/share/nginx/html/pc;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;($http_user_agent&amp;nbsp;~*&amp;nbsp;&amp;#39;(Android|webOS|iPhone|iPod|BlackBerry)&amp;#39;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;/usr/share/nginx/html/mobile;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;index&amp;nbsp;index.html;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;配置基本没什么不一样的，主要多了一个&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;if&lt;/code&gt;&amp;nbsp;语句，然后使用&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;$http_user_agent&lt;/code&gt;&amp;nbsp;全局变量来判断用户请求的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;user-agent&lt;/code&gt;，指向不同的 root 路径，返回对应站点。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;在浏览器访问这个站点，然后 F12 中模拟使用手机访问：&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;&lt;img src=&quot;https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2020/4/29/171c4e97062c5124~tplv-t2oaga2asx-zoom-in-crop-mark:1512:0:0:0.awebp&quot; alt=&quot;62haogU3DtwMRiZ&quot; loading=&quot;lazy&quot; style=&quot;border-style: none;z-index: 10000;cursor: zoom-in;transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1) 0s !important;max-width: 100%&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;可以看到在模拟使用移动端访问的时候，Nginx 返回的站点变成了移动端对应的 html 了。&lt;/p&gt;&lt;h2 data-id=&quot;heading-28&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;14. 配置 HTTPS&lt;/h2&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;具体配置过程网上挺多的了，也可以使用你购买的某某云，一般都会有&lt;a href=&quot;https://link.juejin.cn/?target=https%3A%2F%2Fcloud.tencent.com%2Fdocument%2Fproduct%2F400%2F6814&quot; target=&quot;_blank&quot; title=&quot;https://cloud.tencent.com/document/product/400/6814&quot; ref=&quot;nofollow noopener noreferrer&quot; style=&quot;;cursor: pointer;color: rgb(2, 105, 200);border-bottom: 1px solid rgb(209, 233, 255)&quot;&gt;免费申请&lt;/a&gt;的服务器证书，安装直接看所在云的操作指南即可。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;我购买的腾讯云提供的亚洲诚信机构颁发的免费证书只能一个域名使用，二级域名什么的需要另外申请，但是申请审批比较快，一般几分钟就能成功，然后下载证书的压缩文件，里面有个 nginx 文件夹，把&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;xxx.crt&lt;/code&gt;&amp;nbsp;和&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;xxx.key&lt;/code&gt;&amp;nbsp;文件拷贝到服务器目录，再配置下：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;443&amp;nbsp;ssl&amp;nbsp;http2&amp;nbsp;default_server;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;SSL&amp;nbsp;访问端口号为&amp;nbsp;443&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;填写绑定证书的域名&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssl_certificate&amp;nbsp;/etc/nginx/https/1_sherlocked93.club_bundle.crt;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;证书文件地址&amp;nbsp;&amp;nbsp;&amp;nbsp;ssl_certificate_key&amp;nbsp;/etc/nginx/https/2_sherlocked93.club.key;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;私钥文件地址&amp;nbsp;&amp;nbsp;&amp;nbsp;ssl_session_timeout&amp;nbsp;10m;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssl_protocols&amp;nbsp;TLSv1&amp;nbsp;TLSv1.1&amp;nbsp;TLSv1.2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#请按照以下协议配置&amp;nbsp;&amp;nbsp;&amp;nbsp;ssl_ciphers&amp;nbsp;ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ssl_prefer_server_ciphers&amp;nbsp;on;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/usr/share/nginx/html;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index.html&amp;nbsp;index.htm;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;写完&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -t -q&lt;/code&gt;&amp;nbsp;校验一下，没问题就&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;nginx -s reload&lt;/code&gt;，现在去访问&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;https://sherlocked93.club/&lt;/code&gt;&amp;nbsp;就能访问 HTTPS 版的网站了。&lt;/p&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;一般还可以加上几个增强安全性的命令：&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码add_header&amp;nbsp;X-Frame-Options&amp;nbsp;DENY;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;减少点击劫持&amp;nbsp;add_header&amp;nbsp;X-Content-Type-Options&amp;nbsp;nosniff;&amp;nbsp;#&amp;nbsp;禁止服务器自动解析资源类型&amp;nbsp;add_header&amp;nbsp;X-Xss-Protection&amp;nbsp;1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;防XSS攻击&lt;/pre&gt;&lt;h2 data-id=&quot;heading-29&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;15. 一些常用技巧&lt;/h2&gt;&lt;h3 data-id=&quot;heading-30&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.1 静态服务&lt;/h3&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;&amp;nbsp;static.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;charset&amp;nbsp;utf-8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;防止中文文件名乱码&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/download&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alias&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/usr/share/nginx/html/static;&amp;nbsp;&amp;nbsp;#&amp;nbsp;静态资源目录&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;autoindex&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;on;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;开启静态资源列目录&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;autoindex_exact_size&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;off;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;on(默认)显示文件的确切大小，单位是byte；off显示文件大概大小，单位KB、MB、GB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;autoindex_localtime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;off;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;off(默认)时显示的文件时间为GMT时间；on显示的文件时间为服务器时间&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;h3 data-id=&quot;heading-31&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.2 图片防盗链&lt;/h3&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;&amp;nbsp;*.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;图片防盗链&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;~*&amp;nbsp;\.(gif|jpg|jpeg|png|bmp|swf)$&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;valid_referers&amp;nbsp;none&amp;nbsp;blocked&amp;nbsp;server_names&amp;nbsp;~\.google\.&amp;nbsp;~\.baidu\.&amp;nbsp;*.qq.com;&amp;nbsp;&amp;nbsp;#&amp;nbsp;只允许本机&amp;nbsp;IP&amp;nbsp;外链引用，感谢&amp;nbsp;@木法传&amp;nbsp;的提醒，将百度和谷歌也加入白名单&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;($invalid_referer){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;403;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;h3 data-id=&quot;heading-32&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.3 请求过滤&lt;/h3&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码#&amp;nbsp;非指定请求全返回&amp;nbsp;403&amp;nbsp;if&amp;nbsp;(&amp;nbsp;$request_method&amp;nbsp;!~&amp;nbsp;^(GET|POST|HEAD)$&amp;nbsp;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;403;&amp;nbsp;}&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;IP访问限制（只允许IP是&amp;nbsp;192.168.0.2&amp;nbsp;机器访问）&amp;nbsp;&amp;nbsp;&amp;nbsp;allow&amp;nbsp;192.168.0.2;&amp;nbsp;&amp;nbsp;&amp;nbsp;deny&amp;nbsp;all;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;&amp;nbsp;html;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;&amp;nbsp;index.html&amp;nbsp;index.htm;&amp;nbsp;}&lt;/pre&gt;&lt;h3 data-id=&quot;heading-33&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.4 配置图片、字体等静态文件缓存&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;由于图片、字体、音频、视频等静态文件在打包的时候通常会增加了 hash，所以缓存可以设置的长一点，先设置强制缓存，再设置协商缓存；如果存在没有 hash 值的静态文件，建议不设置强制缓存，仅通过协商缓存判断是否需要使用缓存。&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;bash代码解读复制代码#&amp;nbsp;图片缓存时间设置&amp;nbsp;location&amp;nbsp;~&amp;nbsp;.*\.(css|js|jpg|png|gif|swf|woff|woff2|eot|svg|ttf|otf|mp3|m4a|aac|txt)$&amp;nbsp;{&amp;nbsp;&amp;nbsp;expires&amp;nbsp;10d;&amp;nbsp;}&amp;nbsp;&amp;nbsp;#&amp;nbsp;如果不希望缓存&amp;nbsp;expires&amp;nbsp;-1;&lt;/pre&gt;&lt;h3 data-id=&quot;heading-34&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.5 单页面项目 history 路由配置&lt;/h3&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;&amp;nbsp;fe.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;/usr/share/nginx/html/dist;&amp;nbsp;&amp;nbsp;#&amp;nbsp;vue&amp;nbsp;打包后的文件夹&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index.html&amp;nbsp;index.htm;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;try_files&amp;nbsp;&amp;nbsp;$uri&amp;nbsp;$uri/&amp;nbsp;/index.html&amp;nbsp;@rewrites;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;expires&amp;nbsp;-1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;首页一般没有强制缓存&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;add_header&amp;nbsp;Cache-Control&amp;nbsp;no-cache;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;接口转发，如果需要的话&amp;nbsp;&amp;nbsp;&amp;nbsp;#location&amp;nbsp;~&amp;nbsp;^/api&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;http://be.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;#}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;@rewrites&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rewrite&amp;nbsp;^(.+)$&amp;nbsp;/index.html&amp;nbsp;break;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;h3 data-id=&quot;heading-35&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.6 HTTP 请求转发到 HTTPS&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;配置完 HTTPS 后，浏览器还是可以访问 HTTP 的地址&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;http://sherlocked93.club/&lt;/code&gt;&amp;nbsp;的，可以做一个 301 跳转，把对应域名的 HTTP 请求重定向到 HTTPS 上&lt;/p&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;www.sherlocked93.club;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;单域名重定向&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;($host&amp;nbsp;=&amp;nbsp;&amp;#39;www.sherlocked93.club&amp;#39;){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;301&amp;nbsp;https://www.sherlocked93.club$request_uri;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;全局非&amp;nbsp;https&amp;nbsp;协议时重定向&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;($scheme&amp;nbsp;!=&amp;nbsp;&amp;#39;https&amp;#39;)&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;301&amp;nbsp;https://$server_name$request_uri;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;或者全部重定向&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;301&amp;nbsp;https://$server_name$request_uri;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#&amp;nbsp;以上配置选择自己需要的即可，不用全部加&amp;nbsp;}&lt;/pre&gt;&lt;h3 data-id=&quot;heading-36&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.7 泛域名路径分离&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;这是一个非常实用的技能，经常有时候我们可能需要配置一些二级或者三级域名，希望通过 Nginx 自动指向对应目录，比如：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;test1.doc.sherlocked93.club&lt;/code&gt;&amp;nbsp;自动指向&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/usr/share/nginx/html/doc/test1&lt;/code&gt;&amp;nbsp;服务器地址；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;test2.doc.sherlocked93.club&lt;/code&gt;&amp;nbsp;自动指向&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/usr/share/nginx/html/doc/test2&lt;/code&gt;&amp;nbsp;服务器地址；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;&amp;nbsp;~^([\w-]+)\.doc\.sherlocked93\.club$;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;root&amp;nbsp;/usr/share/nginx/html/doc/$1;&amp;nbsp;}&lt;/pre&gt;&lt;h3 data-id=&quot;heading-37&quot; style=&quot;line-height: 28px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 5px;font-size: 20px&quot;&gt;15.8 泛域名转发&lt;/h3&gt;&lt;p style=&quot;line-height: inherit;margin-top: 22px;margin-bottom: 22px&quot;&gt;和之前的功能类似，有时候我们希望把二级或者三级域名链接重写到我们希望的路径，让后端就可以根据路由解析不同的规则：&lt;/p&gt;&lt;ol style=&quot;padding-left: 28px&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;test1.serv.sherlocked93.club/api?name=a&lt;/code&gt;&amp;nbsp;自动转发到&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;127.0.0.1:8080/test1/api?name=a&amp;nbsp;&lt;/code&gt;；&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;test2.serv.sherlocked93.club/api?name=a&lt;/code&gt;&amp;nbsp;自动转发到&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;127.0.0.1:8080/test2/api?name=a&lt;/code&gt;&amp;nbsp;；&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;pre style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 1em;position: relative;overflow: auto;line-height: 1.75;color: rgb(51, 51, 51)&quot;&gt;nginx代码解读复制代码server&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;listen&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server_name&amp;nbsp;~^([\w-]+)\.serv\.sherlocked93\.club$;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;location&amp;nbsp;/&amp;nbsp;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_set_header&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;X-Real-IP&amp;nbsp;$remote_addr;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_set_header&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;X-Forwarded-For&amp;nbsp;$proxy_add_x_forwarded_for;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_set_header&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Host&amp;nbsp;$http_host;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_set_header&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;X-NginX-Proxy&amp;nbsp;true;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;proxy_pass&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;http://127.0.0.1:8080/$1$request_uri;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&amp;nbsp;}&lt;/pre&gt;&lt;h2 data-id=&quot;heading-38&quot; style=&quot;line-height: 34px;margin-top: 35px;margin-bottom: 10px;padding-bottom: 12px;font-size: 22px;border-bottom: 1px solid rgb(236, 236, 236)&quot;&gt;16. 最佳实践&lt;/h2&gt;&lt;ol style=&quot;padding-left: 28px;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;为了使 Nginx 配置更易于维护，建议为每个服务创建一个单独的配置文件，存储在&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d&lt;/code&gt;&amp;nbsp;目录，根据需求可以创建任意多个独立的配置文件。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;独立的配置文件，建议遵循以下命名约定&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;&amp;lt;服务&amp;gt;.conf&lt;/code&gt;，比如域名是&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;sherlocked93.club&lt;/code&gt;，那么你的配置文件的应该是这样的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/conf.d/sherlocked93.club.conf&lt;/code&gt;，如果部署多个服务，也可以在文件名中加上 Nginx 转发的端口号，比如&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;sherlocked93.club.8080.conf&lt;/code&gt;，如果是二级域名，建议也都加上&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;fe.sherlocked93.club.conf&lt;/code&gt;。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;常用的、复用频率比较高的配置可以放到&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/etc/nginx/snippets&lt;/code&gt;&amp;nbsp;文件夹，在 Nginx 的配置文件中需要用到的位置 include 进去，以功能来命名，并在每个 snippet 配置文件的开头注释标明主要功能和引入位置，方便管理。比如之前的&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;gzip&lt;/code&gt;、&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;cors&lt;/code&gt;&amp;nbsp;等常用配置，我都设置了 snippet。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Nginx 日志相关目录，内以&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;域名.type.log&lt;/code&gt;&amp;nbsp;命名（比如&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club.access.log&lt;/code&gt;&amp;nbsp;和&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;be.sherlocked93.club.error.log&lt;/code&gt;&amp;nbsp;）位于&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;#39;Courier New&amp;#39;, monospace;font-size: 0.87em;border-radius: 2px;overflow-x: auto;background-color: rgb(255, 245, 245);color: rgb(255, 80, 44);padding: 0.065em 0.4em&quot;&gt;/var/log/nginx/&lt;/code&gt;&amp;nbsp;目录中，为每个独立的服务配置不同的访问权限和错误日志文件，这样查找错误时，会更加方便快捷。&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;</description><pubDate>Tue, 30 Jul 2024 18:16:34 +0800</pubDate></item><item><title>Windows使用VMare安装MacOS10.13系统虚拟机----转载</title><link>http://www.kewang.asia/?id=59</link><description>&lt;p&gt;本文地址：https://blog.csdn.net/qq_40785165/article/details/118739877，转载请附上此链接&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;unlock工具下载：https://github.com/DrDonk/unlocker.git,我这边只能到MacOS10.14,不过已经够用了，不够用的大家可以去找一下其他版本的unlock&lt;/p&gt;&lt;p&gt;（一）VMare的安装&lt;/p&gt;&lt;p&gt;将VMare下载下来之后，一直下一步即可&lt;/p&gt;&lt;p&gt;（二）unlock使用&lt;/p&gt;&lt;p&gt;关闭下列服务：&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/20210714234127170.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwNzg1MTY1,size_16,color_FFFFFF,t_70&quot; alt=&quot;在这里插入图片描述&quot;/&gt;&lt;/p&gt;&lt;p&gt;我的电脑右键-管理-服务，关闭下列服务；&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/20210714234545402.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwNzg1MTY1,size_16,color_FFFFFF,t_70&quot; alt=&quot;在这里插入图片描述&quot;/&gt;&lt;/p&gt;&lt;p&gt;创建虚拟机时&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;https://img-blog.csdnimg.cn/20210714235116709.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQwNzg1MTY1,size_16,color_FFFFFF,t_70&quot; alt=&quot;在这里插入图片描述&quot;/&gt;&lt;/p&gt;&lt;p&gt;安装时若无磁盘，先在磁盘工具中格式化下磁盘；&lt;/p&gt;</description><pubDate>Tue, 27 Feb 2024 16:10:02 +0800</pubDate></item><item><title>linux系统下查看cpu的读写状况的命令</title><link>http://www.kewang.asia/?id=58</link><description>&lt;div style=&quot;color: rgb(34, 34, 34); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; text-wrap: wrap; background-color: rgb(255, 255, 255); flex-basis: auto !important;&quot; data-mce-style=&quot;color: #222222; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; flex-basis: auto !important;&quot;&gt;&lt;div style=&quot;flex-basis: auto !important;&quot; data-mce-style=&quot;flex-basis: auto !important;&quot;&gt;iostate -x 1 1：查看磁盘的读写信息；&lt;/div&gt;&lt;div style=&quot;flex-basis: auto !important;&quot; data-mce-style=&quot;flex-basis: auto !important;&quot;&gt;pidstat -d：查看进程的io信息；&lt;/div&gt;&lt;div style=&quot;flex-basis: auto !important;&quot; data-mce-style=&quot;flex-basis: auto !important;&quot;&gt;iotop：查看io等待排序；&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Mon, 26 Feb 2024 17:56:34 +0800</pubDate></item></channel></rss>