﻿{"id":412,"date":"2016-09-28T10:34:14","date_gmt":"2016-09-28T02:34:14","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=412"},"modified":"2018-08-05T17:49:09","modified_gmt":"2018-08-05T09:49:09","slug":"centos6%e4%bd%bf%e7%94%a8yum%e5%ae%89%e8%a3%85nginx","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=412","title":{"rendered":"CentOS 6\/7 \u4e0b\u4f7f\u7528yum\u5b89\u88c5nginx"},"content":{"rendered":"<p>Ubuntu\u4e0b\u5b89\u88c5nginx\uff0c\u76f4\u63a5apt-get install nginx\u5c31\u884c\u4e86\uff0c\u5f88\u65b9\u4fbf\u3002<\/p>\n<p>\u4f46\u662f\u4eca\u5929\u88c5\u4e86CentOS6.2\uff0c\u76f4\u63a5yum install nginx\u4e0d\u884c\uff0c\u8981\u5148\u5904\u7406\u4e0b\u6e90\uff0c\u4e0b\u9762\u662f\u5b89\u88c5\u5b8c\u6574\u6d41\u7a0b\uff0c\u4e5f\u5341\u5206\u7b80\u5355\uff1a<\/p>\n<p>1\u3001\u8fd0\u884c\u5e76\u5b89\u88c5\u6e90\uff1a<\/p>\n<p>CentOS 7 \u4e0b\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<pre class=\"lang:sh decode:true\">rpm -Uvh http:\/\/nginx.org\/packages\/centos\/7\/noarch\/RPMS\/nginx-release-centos-7-0.el7.ngx.noarch.rpm<\/pre>\n<p>CentOS 6 \u4e0b\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<pre class=\"lang:sh decode:true \">rpm -ivh http:\/\/nginx.org\/packages\/centos\/6\/noarch\/RPMS\/nginx-release-centos-6-0.el6.ngx.noarch.rpm<\/pre>\n<p>2\uff0c\u67e5\u770byum\u7684nginx\u4fe1\u606f<\/p>\n<pre class=\"lang:sh decode:true \">[]# yum info nginx\r\n\r\nLoaded plugins: fastestmirror\r\n\r\nDetermining fastest mirrors\r\n\r\n\u00a0* base: mirror.esocc.com\r\n\r\n\u00a0* extras: mirror.esocc.com\r\n\r\n\u00a0* updates: mirror.esocc.com\r\n\r\nbase \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 | 3.7 kB \u00a0 \u00a0 00:00 \u00a0 \u00a0\u00a0\r\n\r\nbase\/primary_db \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0| 4.4 MB \u00a0 \u00a0 00:28 \u00a0 \u00a0\u00a0\r\n\r\nextras \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 | 3.5 kB \u00a0 \u00a0 00:00 \u00a0 \u00a0\u00a0\r\n\r\nextras\/primary_db \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0| \u00a019 kB \u00a0 \u00a0 00:00 \u00a0 \u00a0\u00a0\r\n\r\nnginx \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0| 2.9 kB \u00a0 \u00a0 00:00 \u00a0 \u00a0\u00a0\r\n\r\nnginx\/primary_db \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 | \u00a022 kB \u00a0 \u00a0 00:00 \u00a0 \u00a0\u00a0\r\n\r\nupdates \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0| 3.5 kB \u00a0 \u00a0 00:00 \u00a0 \u00a0\u00a0\r\n\r\nupdates\/primary_db \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 | 2.1 MB \u00a0 \u00a0 00:10 \u00a0 \u00a0\u00a0\r\n\r\nInstalled Packages\r\n\r\nName \u00a0 \u00a0 \u00a0 \u00a0: nginx\r\n\r\nArch \u00a0 \u00a0 \u00a0 \u00a0: x86_64\r\n\r\nVersion \u00a0 \u00a0 : 1.4.0\r\n\r\nRelease \u00a0 \u00a0 : 1.el6.ngx\r\n\r\nSize \u00a0 \u00a0 \u00a0 \u00a0: 874 k\r\n\r\nRepo \u00a0 \u00a0 \u00a0 \u00a0: installed\r\n\r\nFrom repo \u00a0 : nginx\r\n\r\nSummary \u00a0 \u00a0 : nginx is a high performance web server\r\n\r\nURL \u00a0 \u00a0 \u00a0 \u00a0 : http:\/\/nginx.org\/\r\n\r\nLicense \u00a0 \u00a0 : 2-clause BSD-like license\r\n\r\nDescription : nginx [engine x] is an HTTP and reverse proxy server, as well as\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 : a mail proxy server<\/pre>\n<p>3\uff0c\u5b89\u88c5nignx<br \/>\n[root@server ~]# yum install nginx<\/p>\n<p>4\uff0c\u542f\u52a8nginx<\/p>\n<p>CentOS 7 \u4e0b\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\uff1a<\/p>\n<pre class=\"lang:default decode:true \">systemctl start nginx<\/pre>\n<p>CentOS 6 \u4e0b\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<pre class=\"lang:default decode:true\">service nginx start<\/pre>\n<p>4\uff0c\u7136\u540e\u8fdb\u5165\u6d4f\u89c8\u5668\uff0c\u8f93\u5165http:\/\/xxxxxxx\/\u6d4b\u8bd5\uff0c\u5982\u679c\u770b\u5230<\/p>\n<h1>Welcome to nginx!<\/h1>\n<p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.<\/p>\n<p>For online documentation and support please refer to\u00a0<a href=\"http:\/\/nginx.org\/\">nginx.org<\/a>.<br \/>\nCommercial support is available at\u00a0<a href=\"http:\/\/nginx.com\/\">nginx.com<\/a>.<\/p>\n<p><em>Thank you for using nginx.<\/em><\/p>\n<p>\u606d\u559c\u4f60\uff0c\u4f60\u6210\u529f\u4e86\uff01<\/p>\n<p>5\u3001\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8<\/p>\n<p>CentOS 7 \u4e0b\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<pre class=\"lang:default decode:true \">systemctl enable nginx.service<\/pre>\n<p>CentOS 6\u4e0b\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<pre class=\"lang:default decode:true \">chkconfig nginx on<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu\u4e0b\u5b89\u88c5nginx\uff0c\u76f4\u63a5apt-get install nginx\u5c31\u884c &hellip; <a href=\"http:\/\/blog.sway.com.cn\/?p=412\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149],"tags":[23,152,164],"class_list":["post-412","post","type-post","status-publish","format-standard","hentry","category-nginx","tag-centos","tag-nginx","tag-yum"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=412"}],"version-history":[{"count":5,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/412\/revisions"}],"predecessor-version":[{"id":473,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/412\/revisions\/473"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=412"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}