{"id":245,"date":"2018-02-28T19:00:25","date_gmt":"2018-02-28T11:00:25","guid":{"rendered":"https:\/\/cloudbool.com\/archive\/?p=245"},"modified":"2018-02-28T19:00:25","modified_gmt":"2018-02-28T11:00:25","slug":"linux-install-official-repo-nginx","status":"publish","type":"post","link":"https:\/\/cloudbool.com\/archive\/linux-install-official-repo-nginx.html","title":{"rendered":"Linux\u5b89\u88c5\u5b98\u65b9\u6700\u65b0\u7248\u7684Nginx"},"content":{"rendered":"<p>\u867d\u7136\u5404\u5927\u53d1\u884c\u7248\u6e90\u91cc\u6216\u8005\u7b2c\u4e09\u65b9\u6e90\u90fd\u6709\u4e86Nginx\uff0c\u4f46\u662f\u56e0\u4e3a\u5404\u4e2a\u53d1\u884c\u7248\u7684\u5dee\u5f02\uff0c\u6e90\u91cc\u7684\u53ef\u80fd\u4e0d\u662f\u6700\u65b0\u7684\uff0c\u4e14\u5404\u4e2a\u53d1\u884c\u7248\u9ed8\u8ba4\u914d\u7f6e\u4e5f\u4e0d\u4e00\u6837\uff0c\u4e3a\u4e86\u7edf\u4e00\uff0c\u6211\u66f4\u4e60\u60ef\u4f7f\u7528Nginx\u5b98\u65b9\u7684\u5305\uff0c\u8fd9\u6837\u53ef\u4ee5\u540c\u4e00\u4efd\u914d\u7f6e\u6587\u4ef6\u5728\u5404\u4e2aLinux\u7cfb\u7edf\u4e0a\u7684Nginx\u4e2d\u8fd0\u884c\uff0c\u8fd9\u91cc\u5206\u4eab\u4e00\u4e0b\u6211\u7684\u65b9\u6cd5\u3002<br \/>\n<!--more--><\/p>\n<h2>CentOS\u7cfb\u7edf\u6dfb\u52a0Nginx\u5b98\u65b9\u6e90<\/h2>\n<p>CentOS\u7cfb\u7edf\u5b98\u65b9\u6e90\u4ed3\u5e93\u6587\u4ef6\u5728<strong><em>\/etc\/yum.repos.d\/<\/em><\/strong>\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5728\u4e0b\u9762\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u4fdd\u5b58Nginx\u7684\u6e90\u5c31\u597d\u4e86\uff0c\u5047\u5982\u8bf4\u53eb\u505a<strong><em>nginx.repo<\/em><\/strong>\uff0c\u7136\u540e\u590d\u5236\u5982\u4e0b\u5185\u5bb9\u8fdb\u53bb\uff1a<\/p>\n<pre><code>[nginx]\nname=nginx repo\nbaseurl=http:\/\/nginx.org\/packages\/OS\/OSRELEASE\/$basearch\/\ngpgcheck=0\nenabled=1\n<\/code><\/pre>\n<p>\u7528\u5b9e\u9645\u7684\u53d1\u884c\u7248\u66ff\u6362\u4e0a\u9762\u7684OS\u5b57\u7b26\u4e32\uff0c\u6bd4\u5982\u8bf4<strong><em>centos<\/em><\/strong>\u6216\u8005<strong><em>rhel<\/em><\/strong>\uff0cOSRELEASE\u7528\u5177\u4f53\u53d1\u884c\u7248\u53f7\u66ff\u4ee3\uff0c\u6bd4\u5982\u8bf46\u6216\u80057\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0cCentOS 6\u5c31\u66ff\u6362\u6210\/centos\/6\uff0cCentOS\u66ff\u6362\u6210\/centos\/7\u3002<br \/>\n\u6dfb\u52a0\u5b8c\u6210\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5Nginx\u4e86\uff1a<\/p>\n<pre><code>yum install nginx\n<\/code><\/pre>\n<h2>Debian\u53caUbuntu\u6dfb\u52a0Nginx\u5b98\u65b9\u6e90<\/h2>\n<p>\u548cCentOS\u7c7b\u4f3c\uff0c\u6211\u4eec\u4e5f\u9700\u8981\u66f4\u6539\u7cfb\u7edf\u7684\u6e90\u4ed3\u5e93\u6587\u4ef6\uff0c\u53ea\u662f\u6211\u4eec\u6309\u7167\u4e60\u60ef\uff0c\u53ef\u4ee5\u4e0d\u7528\u65b0\u5efa\u6587\u4ef6\uff0c\u76f4\u63a5\u5728\u73b0\u6709\u7684\u6e90\u4ed3\u5e93\u6587\u4ef6\u4e0a\u6dfb\u52a0\u4e24\u884c\u5c31\u884c\u4e86\u3002<br \/>\n\u7528\u7f16\u8f91\u5668\u6253\u5f00<strong><em>\/etc\/apt\/sources.list<\/em><\/strong>\uff0cDebian\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>deb http:\/\/nginx.org\/packages\/debian\/ codename nginx\ndeb-src http:\/\/nginx.org\/packages\/debian\/ codename nginx\n<\/code><\/pre>\n<p>Ubuntu\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>deb http:\/\/nginx.org\/packages\/ubuntu\/ codename nginx\ndeb-src http:\/\/nginx.org\/packages\/ubuntu\/ codename nginx\n<\/code><\/pre>\n<p>\u7136\u540e\u6839\u636e\u5b9e\u9645\u53d1\u884c\u7248\u4ee3\u53f7\uff0c\u66ff\u6362\u4e0a\u9762\u7684<strong><em>code<\/em><\/strong>\u4e3a\u5b9e\u9645\u7684\u53d1\u884c\u7248\u4ee3\u53f7\uff0c\u76f8\u5173\u4ee3\u53f7\u53ef\u4ee5\u7528\u547d\u4ee4<strong><em>cat \/etc\/os-release<\/em><\/strong>\u67e5\u8be2\u5f97\u5230\u3002<br \/>\n\u6dfb\u52a0\u5b8c\u6210\u4e4b\u540e\uff0c\u8fd8\u9700\u8981\u6dfb\u52a0Nginx\u5b98\u65b9\u7684Key\uff0c\u4e0d\u7136\u4f1a\u63d0\u793aKey\u9519\u8bef\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre><code>wget https:\/\/nginx.org\/keys\/nginx_signing.key -O \/tmp\/nginx_signing.key\napt-key add \/tmp\/nginx_signing.key\n<\/code><\/pre>\n<p>\u6dfb\u52a0\u5b8c\u6210\u4e4b\u540e\uff0c\u8981\u5148\u66f4\u65b0\u4ed3\u5e93\u6e90\u4fe1\u606f\u624d\u80fd\u5b89\u88c5Nginx\uff1a<\/p>\n<pre><code>apt-get update\napt-get install nginx\n<\/code><\/pre>\n<p>\u5b89\u88c5\u4e4b\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u67e5\u770bNginx\u7684\u7248\u672c\uff1a<\/p>\n<blockquote><p>\n  nginx -v\n<\/p><\/blockquote>\n<p>\u67e5\u770bNginx\u7684\u7f16\u8bd1\u4fe1\u606f\uff1a<\/p>\n<blockquote><p>\n  nginx -V\n<\/p><\/blockquote>\n<p>\u6d4b\u8bd5\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<blockquote><p>\n  nginx -t\n<\/p><\/blockquote>\n<p>\u53c2\u8003\u4fe1\u606f\uff1ahttps:\/\/nginx.org\/en\/linux_packages.html#stable<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u867d\u7136\u5404\u5927\u53d1\u884c\u7248\u6e90\u91cc\u6216\u8005\u7b2c\u4e09\u65b9\u6e90\u90fd\u6709\u4e86Nginx\uff0c\u4f46\u662f\u56e0\u4e3a\u5404\u4e2a\u53d1\u884c\u7248\u7684\u5dee\u5f02\uff0c\u6e90\u91cc\u7684\u53ef\u80fd\u4e0d\u662f\u6700\u65b0\u7684\uff0c\u4e14\u5404\u4e2a\u53d1\u884c\u7248\u9ed8 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/cloudbool.com\/archive\/linux-install-official-repo-nginx.html\"> <span class=\"screen-reader-text\">Linux\u5b89\u88c5\u5b98\u65b9\u6700\u65b0\u7248\u7684Nginx<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"categories":[182],"tags":[17,27,76,103],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos","tag-debian","tag-nginx","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/comments?post=245"}],"version-history":[{"count":0,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/posts\/245\/revisions"}],"wp:attachment":[{"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/media?parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/categories?post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudbool.com\/archive\/wp-json\/wp\/v2\/tags?post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}