django项目部署到Linux

1. 下载apache源码

[root@mysql ~]# tar -zxvf httpd-2.4.33.tar.gz 
[root@mysql httpd-2.4.33]# ./configure --prefix=/usr/local/apache2/
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... configure: WARNING: APR version 1.4.0 or later is required, found 1.3.9
configure: WARNING: skipped APR at apr-1-config, version not acceptable
no
configure: error: APR not found.  Please read the documentation.

2. 安装APR

[root@mysql apr-1.6.3]# ./configure --prefix=/usr/local/apr/

make&make install

3. 安装apr-util

apr_util的安装依赖于apr,所以需要指定apr的路径

[root@mysql apr-util-1.5.1]#  ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/  

make&make install

4. 安装pcre

[root@mysql pcre-8.35]# ./configure --prefix=/usr/local/pcre/  

make&make install

5. 安装apache

[root@mysql httpd-2.4.33]# ./configure --prefix=/usr/local/apache2  --enable-so --enable-rewirte --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

make时有报错

libtool:   error: cannot find the library '/usr/local/apache2//lib/libapr-1.la' or unhandled argument '/usr/local/apache2//lib/libapr-1.la'
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/root/httpd-2.4.33/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/httpd-2.4.33/support'
make: *** [all-recursive] Error 1

在编译前创建好目录并把apr中的相应文件复制到提示的目录/usr/local/apache2/lib

[root@mysql lib]# cp libapr-1.la /usr/local/apache2/lib
[root@mysql lib]# cp libapr-1.so /usr/local/apache2/lib

删除文件夹重新Make&make install即可

启动apache

[root@mysql bin]# apachectl start
[root@mysql bin]# service httpd status
httpd (pid  103174) is running...
[root@mysql bin]# ps -ef|grep httpd
root     103174      1  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103176 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103177 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103178 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103179 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103180 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103181 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103182 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
apache   103183 103174  0 14:06 ?        00:00:00 /usr/sbin/httpd -k start
root     103201   9310  0 14:06 pts/8    00:00:00 grep httpd

浏览器访问


6. 安装mod_wsgi
[root@mysql mod_wsgi-4.6.4]# ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/python
make&make install

报错

/usr/local/python-2.7.14/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [src/server/mod_wsgi.la] Error 1

这是由于安装python2.7时没有加入--enable-shared参数,安装mod_wsgi时就会报如下错误:"recompile with -fPIC"

重新编译安装python2.7即可

./configure --prefix=/usr/local/python-2.7.14 -enable-shared CFLAGS=-fPIC

接着再安装mod_wsgi成功



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值