{"id":230185,"date":"2023-12-25T16:19:31","date_gmt":"2023-12-25T08:19:31","guid":{"rendered":"https:\/\/www.idc.net\/help\/230185\/"},"modified":"2023-12-25T16:19:31","modified_gmt":"2023-12-25T08:19:31","slug":"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8mod_reflector%e8%ae%be%e7%bd%aeapache","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/230185\/","title":{"rendered":"Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_reflector\u8bbe\u7f6eApache"},"content":{"rendered":"<h1 id=\"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8mod_reflector%e8%ae%be%e7%bd%aeapache-bezKXWxEiH\">Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_reflector\u8bbe\u7f6eApache<\/h1>\n<p>Apache\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5f00\u6e90Web\u670d\u52a1\u5668\u8f6f\u4ef6\uff0c\u7528\u4e8e\u5728\u4e92\u8054\u7f51\u4e0a\u6258\u7ba1\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u662f\u6700\u5e38\u7528\u7684Web\u670d\u52a1\u5668\u8f6f\u4ef6\u4e4b\u4e00\uff0c\u56e0\u5176\u7a33\u5b9a\u6027\u3001\u53ef\u9760\u6027\u548c\u7075\u6d3b\u6027\u800c\u53d7\u5230\u5e7f\u6cdb\u7684\u8ba4\u53ef\u548c\u4f7f\u7528\u3002<\/p>\n<h2 id=\"%e4%bb%80%e4%b9%88%e6%98%afmod_reflector%ef%bc%9f-bezKXWxEiH\">\u4ec0\u4e48\u662fmod_reflector\uff1f<\/h2>\n<p>mod_reflector\u662fApache\u7684\u4e00\u4e2a\u6a21\u5757\uff0c\u5b83\u5141\u8bb8\u670d\u52a1\u5668\u5c06\u8bf7\u6c42\u91cd\u5b9a\u5411\u5230\u5176\u4ed6\u670d\u52a1\u5668\uff0c\u5e76\u5728\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u3002\u5b83\u53ef\u4ee5\u7528\u4e8e\u5b9e\u73b0\u53cd\u5411\u4ee3\u7406\u3001\u8d1f\u8f7d\u5747\u8861\u548c\u5185\u5bb9\u7f13\u5b58\u7b49\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%85mod_reflector-bezKXWxEiH\">\u5b89\u88c5mod_reflector<\/h2>\n<p>\u8981\u4f7f\u7528mod_reflector\uff0c\u9996\u5148\u9700\u8981\u786e\u4fddApache\u5df2\u7ecf\u5b89\u88c5\u5e76\u8fd0\u884c\u5728\u60a8\u7684\u670d\u52a1\u5668\u4e0a\u3002\u7136\u540e\uff0c\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u5b89\u88c5mod_reflector\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/li>\n<li>\u8fdb\u5165Apache\u7684\u6a21\u5757\u76ee\u5f55\u3002\u5728\u5927\u591a\u6570Linux\u7cfb\u7edf\u4e0a\uff0c\u8be5\u76ee\u5f55\u4f4d\u4e8e\u201c\/etc\/httpd\/modules\/\u201d\u3002<\/li>\n<li>\u4e0b\u8f7dmod_reflector\u6a21\u5757\u3002\u60a8\u53ef\u4ee5\u4eceApache\u7684\u5b98\u65b9\u7f51\u7ad9\u6216\u5176\u4ed6\u53ef\u9760\u7684\u6e90\u83b7\u53d6\u6a21\u5757\u7684\u6700\u65b0\u7248\u672c\u3002<\/li>\n<li>\u5c06\u6a21\u5757\u6587\u4ef6\u590d\u5236\u5230Apache\u7684\u6a21\u5757\u76ee\u5f55\u4e2d\u3002<\/li>\n<li>\u7f16\u8f91Apache\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u662f\u201chttpd.conf\u201d\u6587\u4ef6\u3002\u5728\u6587\u4ef6\u4e2d\u627e\u5230\u201cLoadModule\u201d\u884c\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<br \/>\n    <code>LoadModule reflector_module modules\/mod_reflector.so<\/code><\/li>\n<li>\u4fdd\u5b58\u5e76\u5173\u95ed\u914d\u7f6e\u6587\u4ef6\u3002<\/li>\n<li>\u91cd\u65b0\u542f\u52a8Apache\u670d\u52a1\u5668\uff0c\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/li>\n<\/ol>\n<h2 id=\"%e9%85%8d%e7%bd%aemod_reflector-bezKXWxEiH\">\u914d\u7f6emod_reflector<\/h2>\n<p>\u4e00\u65e6mod_reflector\u5b89\u88c5\u6210\u529f\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u7f16\u8f91Apache\u7684\u914d\u7f6e\u6587\u4ef6\u6765\u914d\u7f6e\u5b83\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684\u914d\u7f6e\u9009\u9879\uff1a<\/p>\n<h3 id=\"proxypass-bezKXWxEiH\">ProxyPass<\/h3>\n<p>ProxyPass\u6307\u4ee4\u7528\u4e8e\u5c06\u8bf7\u6c42\u91cd\u5b9a\u5411\u5230\u5176\u4ed6\u670d\u52a1\u5668\u3002\u5b83\u7684\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>ProxyPass \/path http:\/\/example.com\/\n<\/code><\/pre>\n<p>\u5176\u4e2d\uff0c\/path\u662f\u60a8\u8981\u91cd\u5b9a\u5411\u7684URL\u8def\u5f84\uff0chttp:\/\/example.com\/\u662f\u76ee\u6807\u670d\u52a1\u5668\u7684URL\u3002<\/p>\n<h3 id=\"proxypassreverse-bezKXWxEiH\">ProxyPassReverse<\/h3>\n<p>ProxyPassReverse\u6307\u4ee4\u7528\u4e8e\u4fee\u6539\u54cd\u5e94\u5934\u4e2d\u7684URL\uff0c\u4ee5\u4fbf\u6b63\u786e\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002\u5b83\u7684\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>ProxyPassReverse \/path http:\/\/example.com\/\n<\/code><\/pre>\n<p>\u5176\u4e2d\uff0c\/path\u662f\u60a8\u8981\u91cd\u5b9a\u5411\u7684URL\u8def\u5f84\uff0chttp:\/\/example.com\/\u662f\u76ee\u6807\u670d\u52a1\u5668\u7684URL\u3002<\/p>\n<h3 id=\"proxypassmatch-bezKXWxEiH\">ProxyPassMatch<\/h3>\n<p>ProxyPassMatch\u6307\u4ee4\u7528\u4e8e\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914dURL\uff0c\u5e76\u5c06\u8bf7\u6c42\u91cd\u5b9a\u5411\u5230\u5339\u914d\u7684\u76ee\u6807\u670d\u52a1\u5668\u3002\u5b83\u7684\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>ProxyPassMatch ^\/path\/(.*)$ http:\/\/example.com\/$1\n<\/code><\/pre>\n<p>\u5176\u4e2d\uff0c^\/path\/(.*)$\u662f\u6b63\u5219\u8868\u8fbe\u5f0f\uff0chttp:\/\/example.com\/$1\u662f\u76ee\u6807\u670d\u52a1\u5668\u7684URL\uff0c$1\u8868\u793a\u6b63\u5219\u8868\u8fbe\u5f0f\u4e2d\u7684\u7b2c\u4e00\u4e2a\u6355\u83b7\u7ec4\u3002<\/p>\n<h2 id=\"%e7%a4%ba%e4%be%8b-bezKXWxEiH\">\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u4f7f\u7528mod_reflector\u7684\u793a\u4f8b\u914d\u7f6e\uff1a<\/p>\n<pre><code>LoadModule reflector_module modules\/mod_reflector.so\n\n&lt;VirtualHost *:80&gt;\n  ServerName example.com\n  DocumentRoot \/var\/www\/html\n\n  ProxyPass \/api http:\/\/api.example.com\/\n  ProxyPassReverse \/api http:\/\/api.example.com\/\n\n  ProxyPassMatch ^\/blog\/(.*)$ http:\/\/blog.example.com\/$1\n  ProxyPassReverse \/blog http:\/\/blog.example.com\/\n&lt;\/VirtualHost&gt;\n<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6240\u6709\u4ee5\/api\u5f00\u5934\u7684\u8bf7\u6c42\u5c06\u88ab\u91cd\u5b9a\u5411\u5230http:\/\/api.example.com\/\uff0c\u800c\u6240\u6709\u4ee5\/blog\u5f00\u5934\u7684\u8bf7\u6c42\u5c06\u88ab\u91cd\u5b9a\u5411\u5230http:\/\/blog.example.com\/\u3002<\/p>\n<h2 id=\"%e6%80%bb%e7%bb%93-bezKXWxEiH\">\u603b\u7ed3<\/h2>\n<p>\u901a\u8fc7\u5b89\u88c5\u548c\u914d\u7f6emod_reflector\u6a21\u5757\uff0c\u60a8\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u8bf7\u6c42\u91cd\u5b9a\u5411\u5230\u5176\u4ed6\u670d\u52a1\u5668\uff0c\u5e76\u5728\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u3002\u8fd9\u5bf9\u4e8e\u5b9e\u73b0\u53cd\u5411\u4ee3\u7406\u3001\u8d1f\u8f7d\u5747\u8861\u548c\u5185\u5bb9\u7f13\u5b58\u7b49\u529f\u80fd\u975e\u5e38\u6709\u7528\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u53ef\u9760\u7684\u4e91\u8ba1\u7b97\u670d\u52a1\u63d0\u4f9b\u5546\u6765\u6258\u7ba1\u60a8\u7684\u7f51\u7ad9\u6216\u5e94\u7528\u7a0b\u5e8f\uff0c\u540e\u6d6a\u4e91\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u4ed6\u4eec\u63d0\u4f9b\u9999\u6e2f\u670d\u52a1\u5668\u3001\u7f8e\u56fd\u670d\u52a1\u5668\u548c\u4e91\u670d\u52a1\u5668\u7b49\u591a\u79cd\u4ea7\u54c1\uff0c\u5177\u6709\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002\u60a8\u53ef\u4ee5\u5728<a href=\"https:\/\/idc.net\">https:\/\/idc.net<\/a>\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_reflector\u8bbe\u7f6eApache Apache\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5f00\u6e90Web\u670d\u52a1\u5668 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-230185","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/230185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=230185"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/230185\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=230185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=230185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=230185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}