{"id":175,"date":"2012-02-23T01:14:17","date_gmt":"2012-02-22T17:14:17","guid":{"rendered":"http:\/\/www.withonly.com\/?p=175"},"modified":"2012-04-17T13:47:10","modified_gmt":"2012-04-17T05:47:10","slug":"ubuntu%e7%b3%bb%e7%bb%9fapache%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/blog.5danyuan.com\/?p=175","title":{"rendered":"Ubuntu\u7cfb\u7edfApache\u53cd\u5411\u4ee3\u7406\u8bbe\u7f6e"},"content":{"rendered":"<p>\u5148\u8bf4\u4e00\u70b9\u9898\u5916\u8bdd\uff0c\u7cd7\u4e8b\u7684android\u3001windows phone 7\u3001iOS \u7248\u672c\u90fd\u6709\u4e00\u70b9\u70b9\u7709\u76ee\u4e86\uff0candroid\u00a0 \u7684\u7248\u672c\u90fd\u5f00\u59cb\u8fdb\u884c\u7b2c\u4e8c\u7248\u4e86\uff0c\u4f46\u662f\u7f51\u7ad9\u4e00\u76f4\u90fd\u6ca1\u6709\u52a8\u9759\u3002<\/p>\n<p>\u7f51\u7ad9\u90e8\u5206\u6211\u662f\u6253\u7b97\u5206\u4e3a2\u5757\uff0c\u4e00\u5757\u662f\u7ed9mobile html5\u7684\u90a3\u90e8\u5206\uff0c\u7ed9\u90a3\u4e9b java \u548c \u8bfa\u57fa\u4e9a Sysmain \u7684\u7528\u6237\u8bbf\u95ee\u7684\uff1b\u53e6\u5916\u4e00\u90e8\u5206\u662f\u4f20\u7edf\u7f51\u9875\uff0c\u6253\u7b97\u7528 javascript \u548c php \u597d\u597d\u5730\u5199\u4e00\u4e0b\uff0c\u7136\u540e\u770b\u770b\u80fd\u4e0d\u80fd\u627e\u4e00\u4e2a\u524d\u7aef\u65b9\u9762\u7684\u804c\u4f4d\u3002<\/p>\n<p>\u5728\u8fd9\u91cc\uff0c\u8981\u975e\u5e38\u5730\u611f\u8c22\u4e00\u4e2a\u4eba\uff0c\u5c31\u662f\u6211\u7684\u597d\u670b\u53cb<a title=\"ququ\" href=\"http:\/\/www.imququ.com\" target=\"_blank\">ququ<\/a>\u540c\u5b66\uff0c\u4ed6\u7ed9\u4e0e\u6211\u592a\u591a\u592a\u591a\u7684\u5e2e\u52a9\uff0c\u4e8b\u65e0\u5de8\u7ec6\uff0c\u6211\u4e3a\u6709\u8fd9\u6837\u7684\u4e00\u4e2a\u597d\u670b\u53cb\u800c\u9a84\u50b2\u3002<\/p>\n<p>\u672c\u6765\u7a7a\u95f4\u662f\u5728\u56fd\u5916\u7684\uff0c\u5e73\u65f6\u90fd\u662f\u81ea\u5df1\u5728\u7528\uff0c\u7cd7\u4e8b\u7684web\u7248\u672c\u6211\u62c5\u5fc3\u5927\u5bb6\u4f7f\u7528\u901f\u5ea6\u53ef\u80fd\u4f1a\u6709\u70b9\u6162\uff0c\u53ef\u662f\u7528\u56fd\u5185\u7684\u8bdd\u5907\u6848\u5c31\u7b80\u76f4\u662f\u4e00\u4e2a\u676f\u5177\uff0c\u8981\u73b0\u573a\u7167\u76f8\u4e0d\u8bf4\uff0c\u8fd8\u6709\u4e2a\u4eba\u4fe1\u606f\u6cc4\u6f0f\u7684\u98ce\u9669\u3002\u8863\u670d\u81ea\u5df1\u6d17\u5c31\u66fe\u7ecf\u8e29\u4e86\u4e00\u4e2a\u5751\uff0c\u73b0\u5728\u7b80\u76f4\u662f\u975e\u5e38\u5730\u6392\u65a5\u5907\u6848\uff0c\u4e8e\u662f\u6700\u7ec8\u5c31\u7528\u7684\u65b0\u6d6a\u7684SAE\u7a7a\u95f4\u3002<\/p>\n<p>\u7f51\u4e0a\u770b\u4e86\u5f88\u591a\u6559\u7a0b\uff0c\u8bf4\u7684\u662f\u6253\u5f00apache \u7684\u91cd\u5199\u529f\u80fd\uff0c\u867d\u7136\u770b\u7684\u5934\u6655\u6655\u7684\uff0c\u534a\u6309\u7167\u7f51\u4e0a\u7684\u65b9\u6cd5\u4fee\u6539\u534a\u81ea\u5df1\u63e3\u6469\u7740\uff0c\u671f\u95f4\u8fd8\u7ed9ququ\u8fde\u53d1\u4e862\u5c01\u90ae\u4ef6\u5462\u3002\u4e0b\u73ed\u65f6\u6700\u540e\u7684\u6548\u679c\u5c31\u662f\u8bbf\u95ee\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u867d\u7136\u4f1a\u663e\u793a\u671f\u671b\u7684\u5185\u5bb9\uff0c\u4f46\u662f\u5730\u5740\u680f\u7684url\u4f1a\u53d8\u5316\uff0c\u8fd8\u662f\u4f1a\u663e\u793a\u771f\u5b9e\u7684\u5730\u5740\uff0c\u6211\u7528\u5de5\u5177\u67e5\u770b\u4e86\u4e0b\uff0c\u786e\u5b9e\u4f1a\u6709 http 304 \u8bf7\u6c42\u3002<\/p>\n<p>\u8fd9\u4e0d\u662f\u6211\u60f3\u8981\u7684\u3002\u5728\u5403\u8fc7\u665a\u996d\u540e\uff0c\u89c9\u5f97\u8fd9\u6837\u4e5f\u4e0d\u662f\u529e\u6cd5\uff0cququ\u8fd8\u6728\u6709\u56de\u90ae\u4ef6\uff0c\u4e8e\u662f\u5c31\u81ea\u5df1\u7422\u78e8\u5457\uff0c\u7f51\u4e0a\u53c8\u770b\u4e86\u4e00\u4e9b\u5e16\u5b50\uff0c\u6700\u7ec8\u6574\u7406\u5982\u4e0b\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff0c\u9996\u5148\u662f\u8981\u6253\u5f00apache\u7684\u76f8\u5173\u529f\u80fd\u3002<\/p>\n<p>sudo a2enmod rewrite \u6253\u5f00 url \u91cd\u5199\uff0c\u867d\u7136\u53cd\u5411\u4ee3\u7406\u7528\u4e0d\u4e0a\uff0c\u4f46\u662f\u7a0b\u5e8f\u7684\u5176\u5b83\u5730\u65b9\u662f\u9700\u8981\u7684\uff0c\u8fd9\u91cc\u5c31\u4e00\u5e76\u7ed9\u6253\u5f00\u4e86\u3002<br \/>\nsudo a2enmod proxy<br \/>\nsudo a2enmod proxy_http<br \/>\nsudo a2enmod proxy_balancer<\/p>\n<p>\u8fd9\u91cc\u4e00\u5171\u67093\u4e2a\u547d\u4ee4\uff0c\u6211\u5f00\u59cb\u7684\u65f6\u5019\u6309\u7167\u7f51\u4e0a\u7684\u6559\u7a0b\u53ea\u6253\u5f00\u4e86\u7b2c\u4e00\u4e2a\uff0c\u540e\u9762\u76842\u4e2a\u6ca1\u6709\u6253\u5f00\uff0c\u603b\u662f\u62a5\u670d\u52a1\u5668500 \u5185\u90e8\u9519\u8bef\uff0c\u540e\u6765\u6dfb\u52a0\u4e86\u540e\u9762\u76842\u4e2a\u540e\u5c31\u89e3\u51b3\u4e86\u3002\u5982\u679c\u4f60\u5728\u914d\u7f6e\u7684\u65f6\u5019\uff0c\u65e5\u5fd7\u91cc\u63d0\u793a\u201cproxy: No protocol handler was valid for the URL \/. If you are using a DSO version of mod_proxy, make sure the proxy sub\u201d\uff0c\u90a3\u4e48\u4f60\u5e94\u8be5\u548c\u6211\u4e00\u6837\uff0c\u6dfb\u52a0\u540e\u9762\u76842\u4e2a\u529f\u80fd\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff0c\u8bbe\u7f6e\u7f51\u7ad9\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5728ubuntu\u7684apache\u91cc\uff0c\u6bcf\u4e2a\u7f51\u7ad9\u7684\u914d\u7f6e\u6587\u4ef6\u662f\u653e\u5728\u5355\u72ec\u7684\u6587\u4ef6\u91cc\uff0c\u627e\u5230 sites-available \u6587\u4ef6\u5939\u91cc\u5bf9\u5e94\u7684\u6587\u4ef6\u5e76\u4fee\u6539\uff0c\u4fee\u6539\u540e\u7684\u914d\u7f6e\u6587\u4ef6\u5dee\u4e0d\u591a\u662f\u4e0b\u9762\u7684\u6837\u5b50\u3002<br \/>\nServerName www.a.com<br \/>\nDocumentRoot &#8220;\/var\/site\/www\/&#8221;<br \/>\nProxyRequests Off<br \/>\n&lt;Proxy *&gt;<br \/>\nOrder deny,allow<br \/>\nAllow from all<br \/>\n&lt;\/Proxy&gt;<br \/>\nProxyPass \/ http:\/\/host.com\/<br \/>\nProxyPassReverse \/ http:\/\/host.com\/<br \/>\nErrorLog &#8220;\/var\/log\/apache2\/www.log&#8221;<br \/>\nCustomLog &#8220;\/var\/log\/apache2\/www_accesses.log&#8221; common<\/p>\n<p>ProxyRequests \u662f\u4ee3\u7406\u7684\u7c7b\u578b\uff0c\u5982\u679c\u662f on \u5462\u5c31\u8868\u793a\u6b63\u5411\u4ee3\u7406\uff0c\u6211\u4eec\u8fd9\u91cc\u9700\u8981\u7684\u662f\u53cd\u5411\u4ee3\u7406\uff0c\u5c31\u8bbe\u7f6e\u4e3aoff\u3002ProxyPassReverse \/ http:\/\/host.com\/\u00a0\u00a0\u5462\u5c31\u8868\u793a\u628a\u6240\u6709\u7684\u6765\u81ea\u6839\u76ee\u5f55\u7684\u8bf7\u6c42\u90fd\u4ee3\u7406\u5230 http:\/\/host.com\/ \u7684\u6839\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65\u5462\uff0c\u5c31\u662f\u91cd\u542f apache\u3002\u4f7f\u7528 sudo \/etc\/init.d\/apache2 restart \u547d\u4ee4\uff0c\u7136\u540e\u5237\u65b0\u9875\u9762\u5c31\u5927\u529f\u544a\u6210\u4e86\u3002<\/p>\n<p>\u6700\u540e\u56de\u60f3\u8d77\u6765\uff0c\u867d\u7136\u5f88\u7b80\u5355\uff0c\u662f\u771f\u7684\u6298\u817e\u4e86\u597d\u4e45\u3002\u53e6\u5916\u5728\u4eca\u5929\u77e5\u9053\u4e86\u4e00\u4e2a\u5c0f\u6280\u5de7\uff0c\u535a\u5ba2\u672c\u6765\u662f <a href=\"http:\/\/www.withonly.com\">www.withonly.com<\/a>\uff0c\u6211\u662f\u60f3\u76f4\u63a5\u8f93\u5165 withonly.com \u4e5f\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u7684\uff0c\u4f46\u4e00\u76f4\u4e0d\u77e5\u9053\u8981\u5982\u4f55\u8bbe\u7f6e\u3002\u603b\u4e0d\u81f3\u4e8e\u9700\u8981\u65b0\u8bbe\u7f6e\u4e00\u4e2a\u865a\u62df\u76ee\u5f55\u5427\uff0c\u6309\u7167 IIS \u91cc\u7684\u64cd\u4f5c\u6765\u770b\uff0c\u5e94\u8be5\u662f\u4e2a\u5f88\u7b80\u5355\u7684\uff0c\u8fd9\u4e2a\u4e5f\u4e00\u76f4\u6ca1\u6709\u597d\u610f\u601d\u95eeququ\u3002<\/p>\n<p>\u597d\u5728\u4eca\u5929\u6653\u5f97\u4e86\uff0c\u5728\u914d\u7f6e\u6587\u4ef6\u91cc\u8bbe\u7f6e ServerAlias \u5c31\u53ef\u4ee5\u4e86\u3002\u597d\u5427\uff0c\u8fd9\u91cc\u63a5\u53d7\u4f60\u4eec\u5c3d\u60c5\u7684\u9119\u89c6\u3002<\/p>\n<p>\u6587\u5b57\u5199\u5230\u8fd9\u91cc\u57fa\u672c\u4e0a\u5c31\u7b97\u662f\u5b8c\u4e8b\u4e86\uff0c\u5269\u4e0b\u8981\u8003\u8651\u7684\u5c31\u662f\u5982\u4f55\u5c3d\u5feb\u5730\u6e32\u67d3\u9875\u9762\uff0c\u6211\u521a\u624d\u770b\u4e86\u4e0b\u6548\u679c\uff0c\u4e00\u4e2a\u8bf7\u6c42\u4ece\u56fd\u5916\u518d\u5230\u56fd\u5185\uff0c\u901f\u5ea6\u8fd8\u662f\u6162\u4e86\u8bb8\u591a\uff0c\u8fd9\u4e2a\u4f18\u5316\u6211\u8fd8\u662f\u653e\u5728\u524d\u7aef\u53bb\u89e3\u51b3\u5427\u3002<\/p>\n<p>\u591c\u6df1\u4e86\uff0c\u795d\u5927\u5bb6\u597d\u68a6\u3002\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;2012-02-23\u00a0\u00a0 1:23<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u8bf4\u4e00\u70b9\u9898\u5916\u8bdd\uff0c\u7cd7\u4e8b\u7684android\u3001windows phone 7\u3001iOS \u7248\u672c\u90fd\u6709\u4e00\u70b9\u70b9\u7709\u76ee\u4e86\uff0candro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[60,61],"class_list":["post-175","post","type-post","status-publish","format-standard","hentry","category-daily","tag-apache","tag-61"],"_links":{"self":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=175"}],"version-history":[{"count":0,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/175\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}