{"id":1392,"date":"2020-05-25T17:37:18","date_gmt":"2020-05-25T09:37:18","guid":{"rendered":"http:\/\/39.97.231.10\/?p=1392"},"modified":"2020-05-25T17:37:18","modified_gmt":"2020-05-25T09:37:18","slug":"centos7%e9%80%9a%e8%bf%87yum%e5%ae%89%e8%a3%85nginx","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=1392","title":{"rendered":"CentOS7\u901a\u8fc7yum\u5b89\u88c5Nginx"},"content":{"rendered":"<p>Nginx\u662f\u4fc4\u7f57\u65af\u4eba\u7f16\u5199\u7684\u5341\u5206\u8f7b\u91cf\u7ea7\u7684HTTP\u670d\u52a1\u5668,Nginx\uff0c\u5b83\u7684\u53d1\u97f3\u4e3a\u201cengine X\u201d\uff0c\u662f\u4e00\u4e2a\u9ad8\u6027\u80fd\u7684HTTP\u548c\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u540c\u65f6\u4e5f\u662f\u4e00\u4e2aIMAP\/POP3\/SMTP \u4ee3\u7406\u670d\u52a1\u5668\u3002<\/p>\n<h3 id=\\\"autoid-0-0-0\\\">\u5b89\u88c5\u6b65\u9aa4<\/h3>\n<ol>\n<li>\u6dfb\u52a0Nginx\u7684yum\u6e90<\/li>\n<\/ol>\n<pre>rpm -Uvh http:\/\/nginx.org\/packages\/centos\/7\/noarch\/RPMS\/nginx-release-centos-7-0.el7.ngx.noarch.rpm\n<\/pre>\n<ol start=\\\"2\\\">\n<li>\u5b89\u88c5Nginx<\/li>\n<\/ol>\n<pre>yum install -y nginx\n<\/pre>\n<ol start=\\\"3\\\">\n<li>\u542f\u52a8Nginx<\/li>\n<\/ol>\n<pre>systemctl start nginx.service<\/pre>\n<p>\u901a\u8fc7IP\u6765\u8bbf\u95ee\u4f60\u7684Web\u9875\u9762\u6765\u9884\u89c8\u4e00\u4e0bNginx\u7684\u9ed8\u8ba4\u9875\u9762\uff1b<br \/>\n<img src=\\\"https:\/\/upload-images.jianshu.io\/upload_images\/17023-b8bd8cdcfa37c42b.png?imageMogr2\/auto-orient\/strip%7CimageView2\/2\/w\/1240\\\" alt=\\\"image.png\\\" \/><\/p>\n<ol start=\\\"4\\\">\n<li>CentOS 7 \u5f00\u673a\u542f\u52a8Nginx<\/li>\n<\/ol>\n<pre>systemctl enable nginx.service\n<\/pre>\n<ol start=\\\"5\\\">\n<li>\u5f00\u653e80\u7aef\u53e3<\/li>\n<\/ol>\n<pre>##Add\nfirewall-cmd --permanent --zone=public --add-port=80\/tcp\n##Reload\nfirewall-cmd --reload\n<\/pre>\n<h3 id=\\\"autoid-0-1-0\\\">Nginx\u914d\u7f6e\u4fe1\u606f<\/h3>\n<ul>\n<li>\u7f51\u7ad9\u6587\u4ef6\u5b58\u653e\u9ed8\u8ba4\u76ee\u5f55<\/li>\n<\/ul>\n<pre>\/usr\/share\/nginx\/html\n<\/pre>\n<ul>\n<li>\u7f51\u7ad9\u9ed8\u8ba4\u7ad9\u70b9\u914d\u7f6e<\/li>\n<\/ul>\n<pre>\/etc\/nginx\/conf.d\/default.conf\n<\/pre>\n<ul>\n<li>\u81ea\u5b9a\u4e49Nginx\u7ad9\u70b9\u914d\u7f6e\u6587\u4ef6\u5b58\u653e\u76ee\u5f55<\/li>\n<\/ul>\n<pre>\/etc\/nginx\/conf.d\/\n<\/pre>\n<ul>\n<li>Nginx\u5168\u5c40\u914d\u7f6e<\/li>\n<\/ul>\n<pre>\/etc\/nginx\/nginx.conf\n<\/pre>\n<ul>\n<li>Nginx\u542f\u52a8<\/li>\n<\/ul>\n<pre>systemctl start nginx.service\n<\/pre>\n<h3>Nginx\u5e38\u7528\u547d\u4ee4<\/h3>\n<pre># \u67e5\u770b\u7248\u672c\nnginx -v\n# \u67e5\u770bnginx\u5b89\u88c5\u76ee\u5f55\uff1a\nps\u00a0 -ef | grep nginx\n#\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\uff1a\nnginx -t\n# \u542f\u52a8\uff1a\nsystemctl start nginx.service\n# \u505c\u6b62\uff1a\nsystemctl stop nginx.service\n# \u91cd\u542f\uff1a\nsystemctl restart nginx.service\n# \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8\uff1a\nsystemctl enable nginx.service\n#\u505c\u6b62\u5f00\u673a\u81ea\u542f\u52a8\uff1a\nsystemctl disable nginx.service\n<em id=\\\"__mceDel\\\"><\/em># \u67e5\u770b\u5f53\u524d\u72b6\u6001\uff1a\nsystemctl status nginx.service\n# \u67e5\u770b\u6240\u6709\u5df2\u542f\u52a8\u7684\u670d\u52a1\uff1a\nsystemctl list-units --type=service<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nginx\u662f\u4fc4\u7f57\u65af\u4eba\u7f16\u5199\u7684\u5341\u5206\u8f7b\u91cf\u7ea7\u7684HTTP\u670d\u52a1\u5668,Nginx\uff0c\u5b83\u7684\u53d1\u97f3\u4e3a\u201cengine X\u201d\uff0c\u662f\u4e00\u4e2a\u9ad8\u6027\u80fd &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=1392\"> <span class=\"screen-reader-text\">CentOS7\u901a\u8fc7yum\u5b89\u88c5Nginx<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","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":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[99],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":1,"uagb_excerpt":"Nginx\u662f\u4fc4\u7f57\u65af\u4eba\u7f16\u5199\u7684\u5341\u5206\u8f7b\u91cf\u7ea7\u7684HTTP\u670d\u52a1\u5668,Nginx\uff0c\u5b83\u7684\u53d1\u97f3\u4e3a\u201cengine X\u201d\uff0c\u662f\u4e00\u4e2a\u9ad8\u6027\u80fd&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1392"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1392"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/1392\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1392"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}