{"id":260,"date":"2016-06-20T18:52:19","date_gmt":"2016-06-20T10:52:19","guid":{"rendered":"http:\/\/blog.haostudio.net\/hwp\/?p=260"},"modified":"2017-07-25T00:08:07","modified_gmt":"2017-07-24T16:08:07","slug":"%e6%89%8b%e5%8b%95%e7%b7%a8%e8%ad%af-mod_wsgi-%e7%b4%80%e9%8c%84","status":"publish","type":"post","link":"https:\/\/blog.haostudio.net\/hwp\/%e6%89%8b%e5%8b%95%e7%b7%a8%e8%ad%af-mod_wsgi-%e7%b4%80%e9%8c%84\/","title":{"rendered":"\u624b\u52d5\u7de8\u8b6f mod_wsgi \u7d00\u9304"},"content":{"rendered":"<!--more-->\n<h2>\u624b\u52d5\u7de8\u8b6f mod_wsgi \u7d00\u9304<\/h2>\n<p>====================================<\/p>\n<h3>\u6e90\u7531:<\/h3>\n<p>\u76ee\u524d\u624b\u4e0a\u6709\u4e00\u500b\u5de5\u4f5c\u74b0\u5883\u662f\u5b89\u88ddARM Debian 7 (wesley), \u800c\u5176apt-get \u53d6\u5f97\u7684mod_wsgi \u662f\u7d66python 3.2\u7248, \u800c\u6211\u4f7f\u7528\u7684\u537b\u662f\u81ea\u884c\u7de8\u8b6f\u7684Python 3.4.4\u7248, \u56e0\u6b64\u9020\u6210Apache \u7528mod_wsgi \u8f09\u5165\u6211\u7684\u7a0b\u5f0f\u662f\u6642\u51fa\u73fe\u4e00\u5806\u602a\u932f\u8aa4\u73fe\u8c61, \u56e0\u6b64\u53ea\u597d\u81ea\u884c\u7de8\u8b6fmod_wsgi \u4f86\u7d66Apache \u4f7f\u7528. \u6ce8\u610f: \u9019\u88e1\u6211\u4f7f\u7528\u7684Python 3.4.4 \u5728\u7de8\u8b6f\u6642, \u5fc5\u9808\u8981\u4f7f\u7528shared library \u7684\u65b9\u5f0f, \u4e0d\u7136\u6703\u9020\u6210mod_wsgi \u9023\u7d50\u5931\u6557. \u6703\u6709\u5982\u4e0b\u7684\u932f\u8aa4\u8a0a\u606f<\/p>\n<pre><code>\/usr\/bin\/ld: \/opt\/py3.4\/lib\/libpython3.4m.a(abstract.o): relocation R_ARM_THM_MOVW_ABS_NC against `PyExc_TypeError&#039; can not be used when making a shared object; recompile with -fPIC\n\/opt\/py3.4\/lib\/libpython3.4m.a: could not read symbols: Bad value\ncollect2: ld returned 1 exit status\n<\/code><\/pre>\n<h3>\u6240\u9700\u5957\u4ef6<\/h3>\n<pre><code># apt-get install apache2 apache2-mpm-worker apache2-threaded-dev\n<\/code><\/pre>\n<h3>\u6d41\u7a0b<\/h3>\n<p>\u9996\u5148\u4f7f\u7528 Python virtual environment, \u4ee5\u78ba\u4fdd\u6211\u4f7f\u7528\u7684python \u662f3.4.4. <a href=\"http:\/\/blog.haostudio.net\/hwp\/%E5%9C%A8debian7%E4%B8%AD%E5%BB%BA%E7%AB%8Bpython3-4%E7%9A%84%E5%B7%A5%E4%BD%9C%E7%92%B0%E5%A2%83\/\">\u53c3\u8003\u6211\u7684\u524d\u4e00\u7bc7\u6587\u7ae0<\/a><\/p>\n<p>\u5230<a href=\"https:\/\/github.com\/GrahamDumpleton\/mod_wsgi\/releases\">\u9019\u88e1<\/a>\u4e0b\u8f09mod_wsgi source code. \u6211\u9019\u88e1\u4f7f\u7528\u7684\u662f4.5.2\u7248<\/p>\n<pre><code># mkdir -p $HOME\/mod_wsgi_src\n1. cd $HOME\/mod_wsgi_src\n1. wget https:\/\/github.com\/GrahamDumpleton\/mod_wsgi\/archive\/4.5.2.tar.gz\n1. tar -zxvf 4.5.2.tar.gz\n1. cd mod_wsgi-4.5.2\n1. .\/configure\n1. make &amp;&amp; make install\n<\/code><\/pre>\n<p>\u88dd\u5b8c\u5f8c, \u6703\u7522\u751f mod_wsgi.so \u4e26\u4e14\u653e\u5230 \/usr\/lib\/apache2\/modules<\/p>\n<p>\u7136\u5f8c\u4fee\u6539Apache2 \u7684\u8a2d\u5b9a, \u4f86\u8f09\u5165\u6b64module, \u4e26\u4e14\u91cd\u65b0\u555f\u52d5Apache2<\/p>\n<pre><code># echo LoadModule wsgi_module \/usr\/lib\/apache2\/modules\/mod_wsgi.so &gt; \/etc\/apache2\/mods-available\/wsgi.load\n1. \/etc\/init.d\/apache2 restart\n<\/code><\/pre>\n<hr \/>\n<h3>\u53c3\u8003<\/h3>\n<ol>\n<li><a href=\"https:\/\/modwsgi.readthedocs.io\/en\/develop\/user-guides\/quick-installation-guide.html\">mod_wsgi Quick Installation Guide<\/a><\/li>\n<li><a href=\"http:\/\/blog.csdn.net\/rufanchen_\/article\/details\/7198697\">tre\u7f16\u8bd1\u4e2d\u7684-shared\u548c-fPIC<\/a><\/li>\n<li><a href=\"http:\/\/code.opencv.org\/issues\/4210\">relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol&#8217; can not be used when making a shared object; recompile with -fPIC (Bug #4210)<\/a><\/li>\n<li><a href=\"http:\/\/stackoverflow.com\/questions\/13812185\/how-to-recompile-with-fpic\">how to recompile with -fPIC<\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,57],"tags":[],"class_list":["post-260","post","type-post","status-publish","format-standard","hentry","category-linux","category-57"],"_links":{"self":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/comments?post=260"}],"version-history":[{"count":5,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":388,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/posts\/260\/revisions\/388"}],"wp:attachment":[{"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/media?parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/categories?post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.haostudio.net\/hwp\/wp-json\/wp\/v2\/tags?post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}