Mac OS 10.10.3下Apache + mod_wsgi配置【一】,10.10.3mod_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(終端會提示輸入密碼的),斷行符號執行,終端輸出最後一行應該是
chmod 755 /usr/libexec/apache2/mod_wsgi.so
至此,已經把mod_wsgi安裝到apache中了。
樓主今天忙著投簡曆了,明天上午、下午出去跑面試.
祝福樓主~明天晚上回來接著整,Django~~
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。