{"id":5026,"date":"2024-07-10T16:11:54","date_gmt":"2024-07-10T08:11:54","guid":{"rendered":"https:\/\/benson80.eu.org\/?p=5026"},"modified":"2024-07-10T16:27:14","modified_gmt":"2024-07-10T08:27:14","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e4%b8%80%e4%b8%aaip%e5%8a%a0%e7%ab%af%e5%8f%a3%e8%ae%bf%e9%97%ae%e7%9a%84%e7%b3%bb%e7%bb%9f%ef%bc%8c%e9%80%9a%e8%bf%87nginx%e5%8f%98%e6%88%90%e5%9f%9f%e5%90%8d%e8%ae%bf","status":"publish","type":"post","link":"https:\/\/benson80.eu.org\/?p=5026","title":{"rendered":"\u5982\u4f55\u5c06\u4e00\u4e2aIP\u52a0\u7aef\u53e3\u8bbf\u95ee\u7684\u7cfb\u7edf\uff0c\u901a\u8fc7Nginx\u53d8\u6210\u57df\u540d\u8bbf\u95ee"},"content":{"rendered":"\n<p>1. \u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5728 DNS \u670d\u52a1\u5546\u90a3\u91cc\u5c06\u4f60\u7684\u57df\u540d\u89e3\u6790\u5230\u4e86\u8be5 IP \u4e0a\u3002\u8fd9\u53ef\u4ee5\u901a\u8fc7\u5728 DNS \u8bbe\u7f6e\u4e2d\u6dfb\u52a0\u4e00\u4e2a A \u8bb0\u5f55\u6765\u5b8c\u6210\u3002<\/p>\n\n\n\n<p>2. \u5b89\u88c5\u548c\u914d\u7f6e Nginx\u3002\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86 Nginx \u5e76\u4e14\u6b63\u786e\u914d\u7f6e\u4e86\u5176\u57fa\u672c\u8bbe\u7f6e\u3002<\/p>\n\n\n\n<p>3. \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u670d\u52a1\u5668\u5757\u6216\u7f16\u8f91\u9ed8\u8ba4\u670d\u52a1\u5668\u5757\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u53ef\u4ee5\u5728 Nginx \u914d\u7f6e\u6587\u4ef6\u7684 <code>sites-available<\/code> \u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u6216\u8005\u76f4\u63a5\u7f16\u8f91\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<p>4. \u5728\u670d\u52a1\u5668\u5757\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u6765\u914d\u7f6e\u53cd\u5411\u4ee3\u7406\uff1a<\/p>\n\n\n\n<p>server {<br>listen 80;<br>server_name yourdomain.com;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location \/ {\n    proxy_pass http:\/\/your_ip_address:your_port;\n    proxy_set_header Host $host;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n}<\/code><\/pre>\n\n\n\n<p>}<\/p>\n\n\n\n<p>\u8bf7\u5c06 <code>yourdomain.com<\/code> \u66ff\u6362\u4e3a\u4f60\u7684\u57df\u540d\uff0c<code>your_ip_address<\/code> \u66ff\u6362\u4e3a\u4f60\u7684 IP \u5730\u5740\uff0c<code>your_port<\/code> \u66ff\u6362\u4e3a\u4f60\u7684\u7aef\u53e3\u53f7\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"763\" height=\"722\" src=\"https:\/\/benson80.eu.org\/wp-content\/uploads\/2024\/07\/image-4.png\" alt=\"\" class=\"wp-image-5032\" srcset=\"https:\/\/benson80.eu.org\/wp-content\/uploads\/2024\/07\/image-4.png 763w, https:\/\/benson80.eu.org\/wp-content\/uploads\/2024\/07\/image-4-300x284.png 300w, https:\/\/benson80.eu.org\/wp-content\/uploads\/2024\/07\/image-4-317x300.png 317w\" sizes=\"auto, (max-width: 763px) 100vw, 763px\" \/><\/figure>\n\n\n\n<p>5. \u4fdd\u5b58\u5e76\u9000\u51fa\u914d\u7f6e\u6587\u4ef6\uff0c\u7136\u540e\u91cd\u65b0\u52a0\u8f7d Nginx \u914d\u7f6e\u4ee5\u5e94\u7528\u66f4\u6539\u3002<\/p>\n\n\n\n<p>6. \u68c0\u67e5\u9632\u706b\u5899\u8bbe\u7f6e\uff0c\u786e\u4fdd\u5141\u8bb8\u901a\u8fc7\u6240\u9009\u7aef\u53e3\u7684\u6d41\u91cf\u3002<\/p>\n\n\n\n<p>7. \u6700\u540e\uff0c\u5728\u6d4f\u89c8\u5668\u4e2d\u8bbf\u95ee\u4f60\u7684\u57df\u540d\uff0c\u5e94\u8be5\u80fd\u591f\u901a\u8fc7\u57df\u540d\u8bbf\u95ee\u4f60\u7684\u7cfb\u7edf\u4e86\u3002<\/p>\n\n\n\n<p>\u8bf7\u6ce8\u610f\uff0c\u4e0a\u8ff0\u6b65\u9aa4\u4ec5\u9002\u7528\u4e8e HTTP\u3002\u5982\u679c\u4f60\u7684\u7cfb\u7edf\u4f7f\u7528 HTTPS\uff0c\u8bf7\u786e\u4fdd\u5728 Nginx \u914d\u7f6e\u4e2d\u6dfb\u52a0 SSL \u8bc1\u4e66\u7684\u76f8\u5173\u8bbe\u7f6e\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5728 DNS \u670d\u52a1\u5546\u90a3\u91cc\u5c06\u4f60\u7684 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5026","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/benson80.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/5026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/benson80.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benson80.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benson80.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/benson80.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5026"}],"version-history":[{"count":5,"href":"https:\/\/benson80.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/5026\/revisions"}],"predecessor-version":[{"id":5033,"href":"https:\/\/benson80.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/5026\/revisions\/5033"}],"wp:attachment":[{"href":"https:\/\/benson80.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benson80.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benson80.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}