{"id":19576,"date":"2017-05-28T06:45:43","date_gmt":"2017-05-27T22:45:43","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/05\/28\/%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-nignx-web-server\/"},"modified":"2021-03-18T17:25:03","modified_gmt":"2021-03-18T09:25:03","slug":"%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-nignx-web-server","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/05\/28\/%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-nignx-web-server\/","title":{"rendered":"\u5728 CentOS 7.x \u4e0b\u5b89\u88dd Nignx Web Server"},"content":{"rendered":"<p>\u4f7f\u7528 nginx \u5957\u4ef6\u5eab\u5b89\u88dd <br \/>1. \u5efa\u7acb nginx \u5957\u4ef6\u5eab <br \/># <span style=\"color: #ff0000\">vim \/etc\/yum.repos.d\/nginx.repo<\/span> <br \/><span style=\"color: #0000ff\">[nginx] <\/span><br \/><span style=\"color: #0000ff\">name=nginx repo <\/span><br \/><span style=\"color: #0000ff\">baseurl=http:\/\/nginx.org\/packages\/centos\/$releasever\/$basearch\/ <\/span><br \/><span style=\"color: #0000ff\">gpgcheck=0 <\/span><br \/><span style=\"color: #0000ff\">enabled=1<\/span> <\/p>\n<p>2. \u5957\u4ef6\u5eab\u66f4\u65b0 <br \/>#<span style=\"color: #ff0000\"> yum update<\/span> <\/p>\n<p>3. \u5b89\u88dd Nginx Web Server <br \/># <span style=\"color: #ff0000\">yum install nginx<\/span> <\/p>\n<p>4. \u5b89\u88dd\u7684\u7248\u672c <br \/># <span style=\"color: #ff0000\">\/sbin\/nginx -V<\/span> <br \/><span style=\"color: #0000ff\">nginx version: nginx\/1.10.3<\/span>[@more@]\u6216\u4f7f\u7528 epel \u5957\u4ef6\u5eab\u5b89\u88dd <br \/>1. \u5b89\u88dd Nginx Web Server <br \/># <span style=\"color: #ff0000\">yum install nginx &#8211;enablerepo=epel<\/span> <\/p>\n<p>2. \u5b89\u88dd\u7684\u7248\u672c <br \/># <span style=\"color: #ff0000\">\/sbin\/nginx -V<\/span> <br \/><span style=\"color: #0000ff\">nginx version: nginx\/1.10.2<\/span> <\/p>\n<p>\u4e8c\u8005\u5dee\u5225 <br \/>1. \u7528 nginx \u5957\u4ef6\u5eab\u5b89\u88dd\u7684\u7248\u672c\u6bd4\u8f03\u65b0 1.10.3 &gt; 1.10.2 <br \/>2. \u7528 epel \u5957\u4ef6\u5eab\u5b89\u88dd\u7684\u5957\u4ef6\u6578\u6bd4\u8f03\u591a 25 &gt; 3 <br \/> <a id=\"res_3790824\" href=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/25793-3790824.png\"> <img decoding=\"async\" src=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/previews-med\/25793-3790824.png\" border=\"0\" alt=\"\" \/> <\/a> <\/p>\n<p> <a id=\"res_3790825\" href=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/25793-3790825.png\"> <img decoding=\"async\" src=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/previews-med\/25793-3790825.png\" border=\"0\" alt=\"\" \/> <\/a> <\/p>\n<p>\u8a2d\u5b9a\u958b\u6a5f\u6642\u555f\u52d5 <br \/># <span style=\"color: #ff0000\">systemctl enable nginx.service<\/span> <br \/><span style=\"color: #0000ff\">Created symlink from \/etc\/systemd\/system\/multi-user.target.wants\/nginx.service to \/usr\/lib\/systemd\/system\/nginx.service.<\/span> <br \/># <span style=\"color: #ff0000\">systemctl start nginx.service<\/span> <\/p>\n<p>\u9632\u706b\u7246\u4e0a\u8a2d\u5b9a<br \/># <span style=\"color: #ff0000\">firewall-cmd &#8211;add-service=http &#8211;permanent<\/span> <br \/># <span style=\"color: #ff0000\">firewall-cmd &#8211;add-service=https &#8211;permanent<\/span><br \/># <span style=\"color: #ff0000\">firewall-cmd &#8211;reload<\/span> <br \/>\u6216 <br \/># <span style=\"color: #ff0000\">iptables -A INPUT -p tcp &#8211;syn -m state &#8211;state NEW &#8211;dport 80 -j ACCEPT<br \/><\/span># <span style=\"color: #ff0000\">iptables -A INPUT -p tcp &#8211;syn -m state &#8211;state NEW &#8211;dport 443 -j ACCEPT<\/span> <\/p>\n<p> \u89c0\u770b\u6210\u679c <span style=\"color: #ff0000\">http:\/\/Server&#8217;IP<\/span><br \/>Nginx \u5957\u4ef6\u5eab<br \/><a id=\"res_3790826\" href=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/25793-3790826.png\"><img decoding=\"async\" src=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/previews-med\/25793-3790826.png\" border=\"0\" alt=\"\" \/><\/a><br \/>EPEL \u5957\u4ef6\u5eab<br \/><a id=\"res_3790827\" href=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/25793-3790827.png\"><img decoding=\"async\" src=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/previews-med\/25793-3790827.png\" border=\"0\" alt=\"\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 nginx \u5957\u4ef6\u5eab\u5b89\u88dd 1. \u5efa\u7acb nginx \u5957\u4ef6\u5eab # vim \/etc\/yum.repos.d\/n &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/05\/28\/%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-nignx-web-server\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u5728 CentOS 7.x \u4e0b\u5b89\u88dd Nignx Web Server\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117,137],"tags":[],"class_list":["post-19576","post","type-post","status-publish","format-standard","hentry","category-c-78462","category-c-78482"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["688388"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19576"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19576"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19576\/revisions"}],"predecessor-version":[{"id":21084,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19576\/revisions\/21084"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19576"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19576"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19576"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}