CentOS7下apache2部署django应用
2017-07-08 00:00
417 查看
一、下载安装包
1) pcre https://sourceforge.net/projects/pcre/?source=typ_redirect
2) httpd https://archive.apache.org/dist/httpd/httpd-2.4.9.tar.gz
3) apr http://mirrors.hust.edu.cn/apache//apr/apr-1.6.2.tar.gz
4) apr-util http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
二、解压编译安装
1)安装关联文件
2)安装httpd
3)启动
进入Apache的安装目录/usr/local/apache/bin(如果你没自定义的话):
三、源码安装mod_wsgi
1)下载源码 https://github.com/GrahamDumpleton/wsgiorg.git
2)到项目目录:
3)配置httpd.conf
a)/etc/httpd/httpd.conf 增加:LoadModule wsgi_module modules/mod_wsgi.so
b)参数django部署wsgi应用,参考地址:https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/
c)重启httpd服务 /usr/local/apache/bin/apachectl restart
http://localhost,可查看效果
部分代码参考:https://segmentfault.com/a/1190000004236397?_ea=539001
1) pcre https://sourceforge.net/projects/pcre/?source=typ_redirect
2) httpd https://archive.apache.org/dist/httpd/httpd-2.4.9.tar.gz
3) apr http://mirrors.hust.edu.cn/apache//apr/apr-1.6.2.tar.gz
4) apr-util http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.0.tar.gz
二、解压编译安装
1)安装关联文件
这时候第一步下载的文件就用的上了; 安装顺序apr -> apr-util ,当然pcre可以乱入(顺序不重要); 安装过程,配置 -> 编译 -> 安装 三部曲; 主要说配置: 进入解压后的apr文件包: [root@root]# ./configure --prefix=/usr/local/apr/(这里配置的是安装路径) # make # make intall 进入解压后的apr-util文件包: [root@root]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config(配置apr-util安装路径,并关联apr文件——确保路径正确) # make # make intall 进入解压后的pcre文件包: [root@root]# ./configure --prefix=/usr/local/pcre(配置安装路径) # make # make intall
2)安装httpd
进入解压后的httpd文件包: [root@root]# ./configure --prefix=/usr/local/apache/ \ --sysconfdir=/etc/httpd \ //指定Apache服务器的配置文件存放位置 --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util/ \ --with-pcre=/usr/local/pcre/ \ --enable-so \ //以动态共享对象(DSO)编译---记得要加,否则以后手动修改配置文件加载新的模块,比如,不配置的话,安装好PHP后,要手动修改conf来loadmodule…… --enable-deflate=shared \ //缩小传输编码的支持 --enable-expires=shared \ //期满头控制 --enable-rewrite=shared \ //基于规则的URL操控 --enable-static-support //建立一个静态链接版本的支持 # make # make intall
3)启动
进入Apache的安装目录/usr/local/apache/bin(如果你没自定义的话):
./apachectl start #启动服务 ./apachectl stop #关闭服务 ./apachectl restart #重启服务
三、源码安装mod_wsgi
1)下载源码 https://github.com/GrahamDumpleton/wsgiorg.git
2)到项目目录:
./configure --with-python=/usr/bin/python --with-apxs=/usr/local/apache/bin/apxs make make install
3)配置httpd.conf
a)/etc/httpd/httpd.conf 增加:LoadModule wsgi_module modules/mod_wsgi.so
b)参数django部署wsgi应用,参考地址:https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/
c)重启httpd服务 /usr/local/apache/bin/apachectl restart
http://localhost,可查看效果
部分代码参考:https://segmentfault.com/a/1190000004236397?_ea=539001
相关文章推荐
- CentOS 7下使用Apache2部署Django项目,解决文件名中含有中文报错的问题
- 【Python】Centos7下部署Django(nginx+gunicorn)
- centos7下采用Nginx+uwsgi来部署django
- 在apache2上使用fastcgi部署django应用
- CentOS7 新机部署Django应用笔记
- CentOS 7下tomcat应用服务简易安装部署
- 初探django-演示charade使用virtualenv来配置项目在centos7下部署
- 用apache2部署Django应用
- centos7 下通过nginx+uwsgi部署django应用
- centos7下采用Nginx+uwsgi来部署django
- centos7下nginx+uwsgi部署django项目问题记录
- centos7下部署python网络爬虫程序及django程序总结
- 初探django-演示charade在centos7下的部署
- 在Ubuntu 14.04 下部署Apache2服务器并发布Django 1.7.6 Web应用(本机)
- django应用的部署与创建
- 128M vps上部署django应用的步骤
- centos6.3下apache2.4.4+mod_wsgi+django部署记录
- 使用fastcgi部署django应用
- 使用fastcgi部署django应用
- html5离线应用流程介绍 (含 apache2下部署的配置离线应用搭建实例)