Mac OS 10.10.3下Apache + mod_wsgi配置【一】

【一】

首先,MAC是自带Apache的,在/private/etc/apache2路径下,能够使用apachectl -v查看版本号。我的版本号例如以下:

Server version: Apache/2.4.10 (Unix)
Server built:   Jan  8 2015 20:48:33

【二】

mod_wsgi下载,找他们的官方网址,例如以下,须要梯子,你懂的

https://code.google.com/p/modwsgi/

下载下来之后,双击.tar,自己主动解压缩,然后我把这个目录拷贝到自己的/Users/Sophie/Documents路径下

【三】./configure,然后sudo make,最后sudo make install

cd /Users/Sophie/Documents/mod_wsgi-4.4.13

ls -al,会发现当前路径下有这个文件configure,运行之

./configure

checking for apxs2... no

checking for apxs... /usr/sbin/apxs

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables... 

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking for prctl... no

checking Apache version... 2.4.10

checking for python... /usr/bin/python

configure: creating ./config.status

config.status: creating Makefile

然后运行make报错了,看来像是权限不足。那就sudo make,没有报错,成功了

Sophie-mbp:mod_wsgi-4.4.13 Sophie$ make
./apxs -c -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE  -Wc,-g -Wc,-O2  -Wc,'-arch x86_64' src/server/mod_wsgi.c src/server/wsgi_*.c -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config  -arch x86_64 -lpython2.7 -ldl  -framework CoreFoundation 
./libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DDARWIN_10  -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -g -O2 -arch x86_64 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE  -c -o src/server/mod_wsgi.lo src/server/mod_wsgi.c && touch src/server/mod_wsgi.slo
rm: src/server/.libs/mod_wsgi.o: Permission denied
error: unable to open output file 'src/server/.libs/mod_wsgi.o': ''
1 error generated.
apxs:Error: Command failed with rc=65536
.
make: *** [src/server/mod_wsgi.la] Error 1


之后再输入命令sudo make install(终端会提示输入password的)。回车运行,终端输出最后一行应该是

chmod 755 /usr/libexec/apache2/mod_wsgi.so

至此,已经把mod_wsgi安装到apache中了。


楼主今天忙着投简历了,明天上午、下午出去跑面试.
祝福楼主~明天晚上回来接着整,Django~~




原文地址:https://www.cnblogs.com/jhcelue/p/6884236.html