{"id":493,"date":"2022-06-17T11:35:31","date_gmt":"2022-06-17T03:35:31","guid":{"rendered":"https:\/\/www.juyingnetwork.com.cn\/?p=493"},"modified":"2022-06-17T11:46:08","modified_gmt":"2022-06-17T03:46:08","slug":"nginx-%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"https:\/\/www.juyingnetwork.com.cn\/?p=493","title":{"rendered":"Nginx \u7f16\u8bd1\u5b89\u88c5"},"content":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u8bb2nginx\u7684\u5e38\u89c4\u6027\u7f16\u8bd1\u5b89\u88c5\uff0c\u4f5c\u4e3anginx\u7684\u5f3a\u5927\u7684\u529f\u80fd\u548c\u9002\u5e94\u6027\uff0c\u5728\u5404\u5927\u7ad9\u70b9\u53ca\u4f01\u4e1a\u5185\u90e8\u8fd0\u8425\u65b9\u9762\u90fd\u6709\u4e0d\u9519\u7684\u8868\u73b0\u3002\u672c\u4f8b\u4e3b\u8981\u4e3a\u4e86\u5206\u4eab\u4e1a\u52a1\u89c4\u8303\u5b89\u88c5\uff0c\u505a\u6280\u672f\u6863\u8bb0\u5f55\uff08\u4e0d\u8bba\u8001\u624b\u548c\u65b0\u624b\u90fd\u53ef\u4ee5\u6309\u6b64\u6b65\u9aa4\u5b8c\u6210\u57fa\u7840\u5b89\u88c5\uff09\u3002<\/p>\n<p>\u73af\u5883\uff1aCentOS7.x<\/p>\n<p>\u8f6f\u4ef6\uff1anginx-1.22.0.tar.gz (\u7a33\u5b9a\u7248\u672c \u83b7\u53d6\u5730\u5740\uff1ahttp:\/\/nginx.org\/en\/download.html)\u5b89\u88c5\uff1a<\/p>\n<p>1\u3001\u5b89\u88c5\u8865\u4e01\u5305<\/p>\n<p><code>yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel<\/code><\/p>\n<p>2\u3001\u51c6\u5907\u5b89\u88c5\u73af\u5883<br \/>\n<code>cd \/tmp<\/code> #\u5230\u7cfb\u7edf\u4e34\u65f6\u76ee\u5f55<br \/>\n<code>mkdir nginx<\/code> #\u5efa\u7acb\u5de5\u4f5c\u76ee\u5f55<br \/>\n<code>cd nginx<\/code> #\u5230\u5de5\u4f5c\u76ee\u5f55<br \/>\n<code>wget http:\/\/nginx.org\/download\/nginx-1.22.0.tar.gz<\/code> #\u4e0b\u8f7dnginx \u5305<br \/>\n<code>tar -xzvf nginx-1.22.0.tar.gz<\/code> #\u89e3\u538b\u5305\u81ea\u52a8\u5728\u672c\u76ee\u5f55\u751f\u6210nginx-1.22.0\u76ee\u5f55<br \/>\n3\u3001\u5b89\u88c5\uff1a<br \/>\n<code>cd nginx-1.22.0<\/code> #\u8fdb\u5165\u76ee\u5f55<br \/>\n<code>mkdir -p \/usr\/local\/nginx<\/code> #\u521b\u5efa\u5c06\u8981\u5b89\u88c5\u7684\u76ee\u5f55<br \/>\n<code>.\/configure --prefix=\/usr\/local\/nginx --with-http_ssl_module --with-http_realip_module<\/code> #\u914d\u7f6e\u73af\u5883&#8212;\u5b89\u88c5\u8def\u5f84\u3001\u6a21\u5757\u3001\u68c0\u6d4b\u5b89\u88c5\u73af\u5883\u7b49 \u4ea7\u751fobjs\u548cMakefile<br \/>\n<code>make &amp;&amp; make install<\/code> #\u7f16\u8bd1\u5e76\u5b89\u88c5<\/p>\n<p>\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7<br \/>\n#\u5b8c\u6210\u540e\u5982\u679c\u8981\u91cd\u65b0\u7f16\u8bd1\u5219\u5148\u5378\u8f7d\u518d\u6e05\u9664\u7f16\u8bd1\u6587\u6863\u518d\u91cd\u65b0\u5f00\u59cb\u5373\u4e0b\u9762\u64cd\u4f5c\uff1a<br \/>\n<code>make uninstall<\/code> #\u5378\u8f7d<br \/>\n<code>make clean<\/code> #\u6e05\u9664\u7f16\u8bd1\u6587\u6863<\/p>\n<p>4\u3001\u542f\u52a8nginx<br \/>\n<code>\/usr\/local\/nginx\/sbin\/nginx<\/code> #\u542f\u52a8nginx<\/p>\n<p><code>\/usr\/local\/nginx\/sbin\/nginx -t<\/code> #\u6d4b\u8bd5\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u6b63\u5e38<\/p>\n<p><code>\/usr\/local\/nginx\/sbin\/nginx -s reload<\/code> #\u91cd\u542f\u8fdb\u7a0b<\/p>\n<p><code>\/usr\/local\/nginx\/sbin\/nginx -s stop<\/code> #\u505c\u6b62\u8fdb\u7a0b<\/p>\n<p>\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7<br \/>\n<code>\/usr\/local\/nginx\/sbin\/nginx -help<\/code> #\u53ef\u67e5\u770b\u76f8\u5173\u9009\u9879<\/p>\n<p><code>ln -s \/usr\/local\/nginx\/sbin\/nginx \/usr\/local\/bin\/<\/code> #\u5efa\u7acb\u94fe\u63a5\uff0c\u53ef\u76f4\u63a5\u4f7f\u7528nginx\u547d\u4ee4<\/p>\n<p>5\u3001\u5b89\u5168\u76f8\u5173<br \/>\n<code>firewall-cmd --permanent --add-port 80\/tcp<\/code> #\u5f00\u653e80\u7aef\u53e3\uff0c\u6c38\u4e45<br \/>\n<code>firewall-cmd --reload<\/code> #\u91cd\u8f7d\u9632\u706b\u5899\u7b56\u7565<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u8bb2nginx\u7684\u5e38\u89c4\u6027\u7f16\u8bd1\u5b89\u88c5\uff0c\u4f5c\u4e3anginx\u7684\u5f3a\u5927\u7684\u529f\u80fd\u548c\u9002\u5e94\u6027\uff0c\u5728\u5404\u5927\u7ad9\u70b9\u53ca\u4f01\u4e1a\u5185\u90e8\u8fd0\u8425\u65b9\u9762\u90fd\u6709\u4e0d\u9519&hellip; <a class=\"more-link\" href=\"https:\/\/www.juyingnetwork.com.cn\/?p=493\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Nginx \u7f16\u8bd1\u5b89\u88c5<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[13],"_links":{"self":[{"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/493"}],"collection":[{"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=493"}],"version-history":[{"count":1,"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":494,"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/493\/revisions\/494"}],"wp:attachment":[{"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.juyingnetwork.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}