{"id":36,"date":"2019-07-23T16:35:45","date_gmt":"2019-07-23T08:35:45","guid":{"rendered":"http:\/\/blog.ohmmx.com\/?p=36"},"modified":"2019-07-25T15:14:30","modified_gmt":"2019-07-25T07:14:30","slug":"%e6%90%ad%e5%bb%baweb%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"http:\/\/blog.ohmmx.com\/?p=36","title":{"rendered":"\u642d\u5efaWEB\u670d\u52a1\u5668"},"content":{"rendered":"\n<p>\u64cd\u4f5c\u7cfb\u7edf\u7684\u6e90\u81ea\u5e26 nginx \u548c apache httpd\uff0c\u4f46\u90fd\u4e0d\u662f\u6700\u65b0\u7248\u672c\u3002<\/p>\n\n\n\n<p>\u5148\u5b89\u88c5\u51e0\u4e2a\u6e90\uff1a<\/p>\n\n\n\n<p>IUS \u7b2c\u4e09\u65b9\u7efc\u5408\u8f6f\u4ef6\u6269\u5c55\uff0c\u5728 https:\/\/ius.io\/GettingStarted\/ \u627e\u5230\u7cfb\u7edf\u5bf9\u5e94\u7684\u5730\u5740<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rpm -Uvh https:\/\/centos7.iuscommunity.org\/ius-release.rpm<\/code><\/pre>\n\n\n\n<p>Nginx\u5b98\u65b9\u6e90\uff0c\u5728 http:\/\/nginx.org\/en\/linux_packages.html \u6309\u7167\u8bf4\u660e\u624b\u52a8\u7f16\u8f91\u6e90repo\u6587\u4ef6\uff0c\u6216\u8005\u5728 http:\/\/nginx.org\/packages\/centos\/ \u6309\u7167\u76ee\u5f55\u7ed3\u6784\u627e\u5230\u5bf9\u5e94\u7684\u5730\u5740<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rpm -Uvh http:\/\/nginx.org\/packages\/centos\/7\/noarch\/RPMS\/nginx-release-centos-7-0.el7.ngx.noarch.rpm<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u88c5 Apache Httpd<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install httpd24u<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u7cfb\u7edf\u670d\u52a1\u540d\u4e3ahttpd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u542f\u52a8httpd\nsystemctl start httpd\n# \u968f\u7cfb\u7edf\u542f\u52a8httpd\nsystemctl enable httpd<\/code><\/pre>\n\n\n\n<p>\u914d\u7f6e\u6587\u4ef6\u5728 \/etc\/httpd \u4e0b\u9762<\/p>\n\n\n\n<p>\u5176\u4e2d conf \u76ee\u5f55\u4e0b\u4e3a\u4e3b\u914d\u7f6e\u6587\u4ef6\uff0c conf.d\n\u76ee\u5f55\u4e0b\u4e3a\u6269\u5c55\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<p>conf\/httpd.conf \u91cc\u6bd4\u8f83\u91cd\u8981\u7684\u914d\u7f6e\u53c2\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u9ed8\u8ba4\u76d1\u542c\u7aef\u53e3\nListen 80\n# \u7f51\u7ad9\u6587\u4ef6\u8def\u5f84\nDocumentRoot \"\/var\/www\/html\"<\/code><\/pre>\n\n\n\n<p>\u5176\u4ed6\u7f51\u7ad9\u548c\u6743\u9650\u7b49\u5c5e\u6027\u8bbe\u7f6e \u8bf7\u53e6\u884c\u4e86\u89e3 \u3002 <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u88c5 Nginx<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install nginx<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u7cfb\u7edf\u670d\u52a1\u540d\u4e3anginx<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u542f\u52a8nginx\nsystemctl start nginx\n# \u968f\u7cfb\u7edf\u542f\u52a8nginx\nsystemctl enable nginx<\/code><\/pre>\n\n\n\n<p>\u914d\u7f6e\u6587\u4ef6\u5728 \/etc\/nginx \u4e0b\u9762<\/p>\n\n\n\n<p>\u4e3b\u914d\u7f6e\u6587\u4ef6\u4e3a nginx.conf \uff0c\u6269\u5c55\u914d\u7f6e\u6587\u4ef6\u5728 conf.d \u76ee\u5f55\u4e0b<\/p>\n\n\n\n<p>\u53ef\u4ee5\u914d\u7f6e\u591a\u4e2a server\uff0c\u6bcf\u4e2a server\n\u5355\u72ec\u76d1\u542c\u4e00\u4e2a\u7aef\u53e3\uff0c\u4e3a\u4e86\u65b9\u4fbf\u53ef\u4ee5\u5c06 server \u653e\u5728\u4e00\u4e2a\u5355\u72ec\u7684\u914d\u7f6e\u6587\u4ef6\u91cc\uff0c\u914d\u7f6e\u6587\u4ef6\u4ee5 .conf \u4f5c\u4e3a\u6269\u5c55\u540d\uff0c\u5c06\u88ab\u8bbe\u7f6e\u5f15\u7528\u3002<\/p>\n\n\n\n<p>\u9ed8\u8ba4\u914d\u7f6e\u5728 default.conf \u91cc\uff0c\u8fd9\u91cc\u5355\u72ec\u65b0\u5efa\u4e00\u4e2a\u7f51\u7ad9\u7684\u914d\u7f6e\u6587\u4ef6 site.conf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u628a\u65d7\u4e0b\u6240\u6709\u7684\u57df\u540d\u90fd\u8df3\u8f6c\u5230\u4e3b\u57df\u540d\u4e0a\nserver {\n        listen      2000;\n        server_name site1.com site2.com site2.net www.site2.com www.site2.net;\n        return 301 $scheme:\/\/www.site1.com$request_uri;\n}\n\nserver {\n        listen      2000;\n        server_name www.site1.com;\n\n        location \/ {\n                root   \/home\/site;\n                index  index.html index.htm;\n                # \u76ee\u5f55\u6d4f\u89c8\u529f\u80fd\n                autoindex off;\n                # \u76ee\u5f55\u6d4f\u89c8\u6587\u4ef6\u5927\u5c0f\u7cbe\u786e\u663e\u793a\uff0c\u5173\u95ed\u540e\u5927\u6587\u4ef6\u5c06\u663e\u793aKB MB GB\u7b49\n                autoindex_exact_size off;\n                # \u76ee\u5f55\u6d4f\u89c8\u6587\u4ef6\u65f6\u95f4\u663e\u793a\uff0c\u6253\u5f00\u663e\u793a\u672c\u5730\u65f6\u533a\u65f6\u95f4\uff0c\u5173\u95ed\u663e\u793aGMT\u65f6\u95f4\n                autoindex_localtime on;\n        }\n}<\/code><\/pre>\n\n\n\n<p>\u540e\u9762\u4e3b\u8981\u5c31\u4f7f\u7528nginx\u4f5c\u4e3a\u7f51\u7ad9\u7684WEB\u670d\u52a1\u5668\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u64cd\u4f5c\u7cfb\u7edf\u7684\u6e90\u81ea\u5e26 nginx \u548c apache httpd\uff0c\u4f46\u90fd\u4e0d\u662f\u6700\u65b0\u7248\u672c\u3002  &hellip; <a href=\"http:\/\/blog.ohmmx.com\/?p=36\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[14,15,13],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-server","tag-apache","tag-nginx","tag-web"],"_links":{"self":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":4,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":42,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions\/42"}],"wp:attachment":[{"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ohmmx.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}