{"id":292806,"date":"2024-08-25T21:19:29","date_gmt":"2024-08-25T13:19:29","guid":{"rendered":"https:\/\/lrxjmw.cn\/jxzlhjxcgbsa.html"},"modified":"2024-08-25T21:19:29","modified_gmt":"2024-08-25T13:19:29","slug":"jxzlhjxcgbsa","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/jxzlhjxcgbsa.html","title":{"rendered":"\u89e3\u6790\u5728 Linux \u73af\u5883\u4e0b\u6210\u529f\u90e8\u7f72 Apache \u670d\u52a1\u5668\u7684\u65b9\u6cd5"},"content":{"rendered":"
\u8bda\u631a\u9080\u8bf7\u60a8\u53c2\u4e0e\u6b64\u6b21\u7814\u8ba8\u4f1a\uff0c\u8bae\u9898\u6df1\u5165\u6d45\u51fa\uff0c\u65e8\u5728\u89e3\u6790\u5982\u4f55\u5728Linux<\/a>\u73af\u5883\u4e0b\u6210\u529f\u90e8\u7f72Apache<\/a>\u670d\u52a1\u5668\u3002<\/p>\n \u6211\u4eec\u5fc5\u987b\u8ba4\u53efLinux<\/a>\u7cfb\u7edf<\/a>\u7684\u95ea\u5149\u70b9\uff0c\u5c24\u5176\u662fapache\u670d\u52a1\u5668\uff0c\u62c5\u4efb\u8d77\u7f51\u9875\u670d\u52a1\u7684\u5173\u952e\u89d2\u8272\u3002\u5c3d\u7ba1apache\u7684\u90e8\u7f72\u53ef\u80fd\u663e\u5f97\u7e41\u7410\uff0c\u4f46\u53ea\u8981\u719f\u7ec3\u638c\u63e1\u76f8\u5e94\u6280\u80fd\u5e76\u5177\u6709\u8db3\u591f\u8010\u6027\uff0c\u4ecd\u7136\u80fd\u591f\u6210\u529f\u9a7e\u9a6d\u8fd9\u4e00\u5f3a\u5927\u5de5\u5177\uff0c\u53d1\u6325\u5176\u6700\u5927\u6548\u80fd\u3002\u53c2\u7167\u672c\u7bc7\u6307\u5357\u8fdb\u884c\u64cd\u4f5c\uff0c\u60a8\u5c06\u8f7b\u677e\u5728linux\u7cfb\u7edf\u73af\u5883\u4e0b\u5b8c\u6210apache\u7684\u914d\u7f6e\u548c\u5b89\u88c5\u3002<\/p>\n \u51c6\u5907\u5de5\u4f5c\uff1a\u68c0\u67e5\u4f60\u7684Linux\u7248\u672c<\/b><\/p>\n \u5728\u6267\u884c\u670d\u52a1\u5668\u6574\u5408\u8fc7\u7a0b\u4e2d\uff0c\u52a1\u5fc5\u786e\u4fddLinux\u7cfb\u7edf\u4e0eApache\u4e4b\u95f4\u7684\u9002\u914d\u3002\u6b64\u6b65\u9aa4\u5982\u9009\u7528\u5408\u9002\u7684\u8dd1\u978b\uff0c\u5c06\u5927\u5927\u63d0\u5347\u7cfb\u7edf\u6574\u4f53\u6027\u80fd\u5e76\u4e14\u4fdd\u969c\u5176\u5b8c\u5584\u7684\u517c\u5bb9\u6027\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528`lsb_release-a`\u6307\u4ee4\u4ece\u63a7\u5236\u53f0\u67e5\u8be2Linux\u7cfb\u7edf\u5f53\u524d\u7248\u672c\u4fe1\u606f\u3002\u7531\u4e8e\u5404\u7248\u672c\u7684\u64cd\u4f5c\u65b9\u5f0f\u7565\u6709\u5dee\u5f02\uff0c\u4e3a\u6b64\u73af\u8282\u589e\u6dfb\u4e86\u989d\u5916\u7684\u8c28\u614e\u8981\u6c42\u3002<\/p>\n \u8bf7\u52a1\u5fc5\u4fdd\u6301\u7cfb\u7edf\u5904\u4e8e\u6700\u65b0\u72b6\u6001\uff0c\u4f9d\u7167\u201csudoapt-getupdate\u201d\u53ca\u201csudoapt-getupgrade\u201d\u547d\u4ee4<\/a>\uff0c\u5b9e\u73b0\u8f6f\u4ef6\u5305\u7684\u5168\u9762\u66f4\u65b0\uff0c\u4ee5\u9632\u5728\u5b89\u88c5Apache\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u610f\u5916\u60c5\u51b5\u3002<\/p>\n \u5b89\u88c5Apache\uff1a\u5f00\u59cb\u6211\u4eec\u7684\u5192\u9669\u4e4b\u65c5<\/b><\/p>\n <\/p>\n \u9884\u7f6e\u73af\u5883\u5b8c\u6574\u4e4b\u540e\uff0c\u8bf7\u5728\u754c\u9762\u5185\u952e\u5165\u547d\u4ee4`sudoapt-getinstallapache2`\u5e76\u6309\u4e0b\u56de\u8f66\u3002\u6b64\u64cd\u4f5c\u5c06\u542f\u52a8Apache\u7684\u5373\u65f6\u5b89\u88c5\u7a0b\u5e8f\u3002\u5b89\u88c5\u671f\u95f4\uff0c\u656c\u8bf7\u60a8\u5c55\u793a\u51fa\u5982\u540c\u54c1\u5473\u4f18\u8d28\u5496\u5561\u822c\u7684\u51b7\u9759\u4e0e\u8010\u5fc3\u3002<\/p>\n \u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u8bf7\u7528\u201csudosystemctlstatusapache2\u201d\u6307\u4ee4\u67e5\u9a8cApache\u8fd0\u884c\u72b6\u51b5\u3002\u82e5\u4e3a\u201cactive\uff08running\uff09\u201d\u5219\u8868\u793aApache\u8fd0\u8f6c\u6b63\u5e38\u3002<\/p>\n \u914d\u7f6eApache\uff1a\u8ba9\u6211\u4eec\u7684\u7f51\u7ad9\u98de\u8d77\u6765<\/b><\/p>\n \u6784\u5efa\u5b8c\u6210Apache\u670d\u52a1\u540e\uff0c\u53ef\u901a\u8fc7\u7ec6\u81f4\u5fae\u8c03\u5404\u9879\u53c2\u6570\u4f18\u5316\u7cfb\u7edf\u6027\u80fd\u3002\u9996\u5148\uff0c\u6309\u60ef\u5e38\u4f5c\u4e1a\u8def\u7ebf\u67e5\u627e\u5e76\u524d\u5f80`\/etc\/apache2\/'\u8def\u5f84\u5185\u7684\u7ba1\u7406\u914d\u7f6e\u6587\u6863\u3002\u6b64\u5904\u867d\u7e41\u6587\u7f1b\u8282\uff0c\u4f46\u53ea\u9700\u5ba1\u89c6\u4e24\u4efd\u5173\u952e\u6587\u4ef6\u2014\u2014`apache2.conf`\u53ca`000-default.conf`\u5373\u53ef\u3002<\/p>\n \u5728Apache2.conf\u6587\u4ef6\u4e2d\uff0c\u53ef\u5236\u5b9a\u5168\u5c40\u670d\u52a1\u5668\u53c2\u6570\uff0c\u6d89\u53ca\u5230\u8fd0\u884c\u7528\u6237\u53ca\u7ec4\u522b\uff0c\u53ca\u65e5\u5fd7\u50a8\u5b58\u8def\u5f84\u7b49\u4e8b\u9879\uff1b\u800c\u5728000-default.conf\u6587\u4ef6\u4e2d\uff0c\u4fbf\u4e8e\u5bf9\u5404\u4e2a\u865a\u62df\u4e3b\u673a\uff08\u5373\u4f17\u591a\u7f51\u7ad9\uff09\u5b9e\u65bd\u8be6\u5c3d\u914d\u7f6e\uff0c\u5176\u4e2d\u6db5\u76d6\u4e86\u7f51\u7ad9\u6839\u76ee\u5f55\u7684\u786e\u7acb\u4e0e\u670d\u52a1\u5668\u540d\u79f0\u7b49\u5173\u952e\u8981\u7d20\u3002<\/p>\n \u52a1\u5fc5\u6ce8\u610f\u5728\u5b9e\u8df5\u64cd\u4f5c\u4e2d\u7684\u6bcf\u4e00\u6b21\u914d\u7f6e\u6587\u4ef6\u53d8\u66f4\u540e\uff0c\u90fd\u9700\u8981\u91cd\u542fApache\u670d\u52a1\u5668\u4ee5\u786e\u4fdd\u65b0\u7684\u8bbe\u7f6e\u80fd\u591f\u6210\u529f\u52a0\u8f7d\u6267\u884c\u3002\u53ef\u5229\u7528\u7ec8\u7aef\u7684\u6307\u4ee4`sudosystemctlrestartapache2`\u8f7b\u677e\u5b9e\u73b0\u4e4b\u3002<\/p>\n \u6d4b\u8bd5\u4f60\u7684Apache\uff1a\u770b\u770b\u4f60\u7684\u6210\u679c<\/b><\/p>\n Apache\u670d\u52a1\u5668\u5b8c\u6210\u90e8\u7f72\u540e\u5e94\u5f00\u5c55\u5168\u65b9\u4f4d\u68c0\u67e5\uff0c\u4ee5\u786e\u4fdd\u7ad9\u70b9\u5f97\u4ee5\u5728\u7406\u60f3\u73af\u5883\u4e0b\u7a33\u5b9a\u8fd0\u884c\u3002\u82e5\u53ef\u76f4\u63a5\u901a\u8fc7IP\u5730\u5740\u8bbf\u95ee\u5230Apache\u9ed8\u8ba4\u9875\u9762\uff0c\u5219\u8bf4\u660e\u670d\u52a1\u5668\u72b6\u6001\u6b63\u5e38\uff0c\u7ad9\u70b9\u4e5f\u5c06\u4fdd\u6301\u7a33\u5b9a\u8fd0\u884c\u3002<\/p>\n \u82e5\u5df2\u5efa\u7acb\u72ec\u7acb\u7ad9\u70b9\u8d44\u6599\u5939linux\u662f\u4ec0\u4e48\u7cfb\u7edf\uff0c\u8bf7\u5c06\u5176\u653e\u7f6e\u4e8e\u6307\u5b9a\u8def\u5f84'\/var\/www\/html\/'arch linux\uff0c\u5e76\u66ff\u6362\u539f\u6709index.html\u6587\u4ef6\u3002\u5b8c\u6210\u540e\uff0c\u8bf7\u7acb\u5373\u5237\u65b0\u6d4f\u89c8\u5668\uff0c\u60a8\u7684\u4e2a\u4eba\u7f51\u7ad9\u4fbf\u53ef\u5b8c\u7f8e\u5448\u73b0\u3002\u6b64\u523b\uff0c\u60a8\u6216\u8bb8\u80fd\u611f\u53d7\u5230\u8eab\u4e3a\u4e13\u4e1a\u7f51\u9875\u8bbe\u8ba1\u5e08\u7684\u6ee1\u8db3\u611f\u3002<\/p>\n \u5e38\u89c1\u95ee\u9898\u89e3\u51b3\uff1a\u9047\u5230\u95ee\u9898\u4e0d\u8981\u614c<\/b><\/p>\n \u5728\u914d\u7f6e\u4e0e\u8bbe\u5b9aApache\u73af\u5883\u65f6\uff0c\u5e38\u4f1a\u906d\u9047\u542f\u52a8\u5931\u8d25\u6216\u8005\u9875\u9762\u65e0\u6cd5\u52a0\u8f7d\u7b49\u95ee\u9898\uff0c\u8fd9\u5c31\u597d\u6bd4\u662f\u5728\u6bd4\u8d5b\u6e38\u620f\u4e2d\u653b\u514b\u96be\u9898\u5e76\u4e0d\u65ad\u63d0\u5347\u81ea\u8eab\u6280\u80fd\u3002<\/p>\n \u9996\u5148\uff0c\u4f7f\u7528'sudoapache2ctlconfigtest'\u547d\u4ee4\u5bf9\u6240\u6709\u914d\u7f6e\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\uff0c\u5018\u82e5\u51fa\u73b0\u4efb\u4f55\u9519\u8bef\uff0c\u7cfb\u7edf\u5c06\u63d0\u4f9b\u5177\u4f53\u800c\u660e\u786e\u7684\u4fee\u590d\u5efa\u8bae\u3002\u9488\u5bf9\u9632\u706b\u5899\u8bbe\u7f6e\uff0c\u52a1\u5fc5\u8ba4\u771f\u6838\u5b9e80\u7aef\u53e3\u7684\u7545\u901a\u72b6\u51b5linux \u5b89\u88c5 apache<\/strong>\uff0c\u4ece\u800c\u786e\u4fdd\u7f51\u7ad9\u7684\u6b63\u5e38\u5bf9\u5916\u8bbf\u95ee\u3002<\/p>\n <\/p>\n \u5982\u95ee\u9898\u4ecd\u7136\u672a\u83b7\u59a5\u5584\u89e3\u51b3linux \u5b89\u88c5 apache<\/strong>\uff0c\u5efa\u8bae\u60a8\u5c1d\u8bd5\u7f51\u7edc\u641c\u7d22\u6216\u54a8\u8be2Linux\u6280\u672f\u793e\u533a\u7684\u8d44\u6df1\u4e13\u5bb6\u3002\u6b64\u793e\u533a\u4ee5\u53cb\u597d\u5408\u4f5c\u7cbe\u795e\u95fb\u540d\u4e8e\u4e16\uff0c\u81f4\u529b\u4e8e\u4e3a\u60a8\u63d0\u4f9b\u5373\u65f6\u53ca\u6709\u4ef7\u503c\u7684\u5e2e\u52a9\u3002<\/p>\n \u5b89\u5168\u52a0\u56fa\uff1a\u4fdd\u62a4\u4f60\u7684\u7f51\u7ad9<\/b><\/p>\n \u8bf7\u52a1\u5fc5\u91cd\u89c6\u5e76\u7262\u8bb0\u7f51\u7edc\u5b89\u5168<\/a>\u7684\u91cd\u8981\u6027\uff0c\u5c24\u5176\u662f\u5728\u6210\u529f\u542f\u52a8Apache\u670d\u52a1\u5668\u540e\u3002\u7f51\u7ad9\u5982\u5bb6\u56ed\uff0c\u9700\u7cbe\u5fc3\u7ef4\u62a4\u5176\u5b89\u5168\u6027\u3002\u5229\u7528SSL\u8bc1\u4e66\u5b9e\u73b0\u7ad9\u70b9HTTPS\uff0c\u4ee5\u4fdd\u969c\u6570\u636e\u4f20\u8f93\u4e4b\u7cbe\u786e\u53ef\u9760\u3002<\/p>\n