{"id":363,"date":"2025-02-06T23:45:48","date_gmt":"2025-02-06T15:45:48","guid":{"rendered":"https:\/\/virtualcardx.com\/?p=363"},"modified":"2026-01-04T13:30:14","modified_gmt":"2026-01-04T05:30:14","slug":"nginx%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%aeip%e7%9b%b4%e6%8e%a5%e8%ae%bf%e9%97%ae%e8%87%aa%e5%8a%a8%e8%b7%b3%e8%bd%ac%e5%88%b0%e5%9f%9f%e5%90%8d","status":"publish","type":"post","link":"https:\/\/virtualcardx.com\/en\/2025\/02\/06\/nginx\u5982\u4f55\u8bbe\u7f6eip\u76f4\u63a5\u8bbf\u95ee\u81ea\u52a8\u8df3\u8f6c\u5230\u57df\u540d\/","title":{"rendered":"nginx how to set IP direct access automatically jump to the domain name"},"content":{"rendered":"<p>Edit the \/etc\/nginx\/sites-available\/default file<\/p>\n\n\n\n<p>Add green section code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\nlisten 80 default_server;\nlisten [::]:80 default_server;\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#3da83e\" class=\"has-inline-color\"><strong>return 301 https:\/\/servername.com:443$request_uri;<\/strong><\/mark>\n}\n\nserver {\n        listen 443 ssl default; server_name _;\n        server_name _;\n<strong>        <mark style=\"background-color:rgba(0, 0, 0, 0);color:#3b853f\" class=\"has-inline-color\">ssl_certificate \/etc\/letsencrypt\/live\/servername.com\/fullchain.pem;<\/mark>\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#237832\" class=\"has-inline-color\">        ssl_certificate_key \/etc\/letsencrypt\/live\/servername.com\/privkey.pem;\n        return 301 https:\/\/servername.com:443$request_uri;<\/mark><\/strong>\n}<\/code><\/pre>\n\n\n\n<p>Save, then restart the nginx server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># systemctl nginx restart<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1024\" height=\"536\" data-src=\"http:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/nginx.webp\" alt=\"\" class=\"wp-image-365 lazyload\" title=\"\" data-srcset=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/nginx.webp 1024w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/nginx-300x157.webp 300w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/nginx-768x402.webp 768w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/nginx-600x314.webp 600w\" data-sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/536;\" \/><\/figure>","protected":false},"excerpt":{"rendered":"<p>Edit \/etc\/nginx\/sites- ... <\/p>\n<p class=\"read-more-container\"><a title=\"nginx how to set IP direct access automatically jump to the domain name\" class=\"read-more button\" href=\"https:\/\/virtualcardx.com\/en\/2025\/02\/06\/nginx\u5982\u4f55\u8bbe\u7f6eip\u76f4\u63a5\u8bbf\u95ee\u81ea\u52a8\u8df3\u8f6c\u5230\u57df\u540d\/#more-363\" aria-label=\"Read more about nginx how to set IP direct access automatically jump to the domain name\">Read more<\/a><\/p>","protected":false},"author":1,"featured_media":365,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology-share","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":1,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"predecessor-version":[{"id":1511,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/363\/revisions\/1511"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/media\/365"}],"wp:attachment":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}