Deploying Django with Apache and mod_wsgi Based on Red Hat Enterprise Linux Server

來源:互聯網
上載者:User

Preconditions:

1. Red Hat Enterprise Linux Server release 5.7 (Tikanga)


STEPs:

1. install gcc, g++ if not

a) Suggest you copy rpm packages from cd-rom: 

    mount /mnt/cdrom /mount/media/

    then, copying and installing these files by order.


2. install or upgrade python:

wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz

mv /usr/bin/python /usr/bin/python_old
ln -s /usr/local/python27/bin/python /usr/bin/

3. Set remi sources for RedHat:

rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpmvi /etc/yum.repos.d/epel.repoenabled=1rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-5.rpmvi /etc/yum.repos.d/remi.repo#modity enabled to 1enabled=1#remove the old yumrpm -aq|grep yum|xargs rpm -e --nodeps# download or copy yum packageswget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpmthen:yum clean Allyum makecacheyum install mysql mysql-serverservice mysqld start/stop/restartmysqladmin -u root password 'new-password'create database test2 default character set utf8 collate utf8_general_ci;# install mysql-python1.2.5,documents http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/1. yum install python-devel mysql-devel zlib-devel openssl-devel2. python setup.py build #Mysql-python source code buildpython setup.py install#install zmq, zmq-python./configure, make , make check, make installeasy_install pyzmq#install pycurl, curlwget http://curl.haxx.se/download/curl-7.24.0.tar.gz./configure, make, make installpyCurl:python setup.py build, install

#install djangopython setup.py install# python manage.py runserve 0.0.0.0:8000 # developing environment#############  apache & mod_wsgi ######################download apache source code: http://mirror.bit.edu.cn/apache/httpd/apr, apr-util: http://mirror.bit.edu.cn/apache/apr/pcre: http://ftp.exim.llorien.org/pcre/
install arptar -zxf apr-1.5.0.tar.gz cd apr-1.5.0 ./configure --prefix=/usr/local/apr make sudo make install 
apr-utiltar –zxvf apr-util-1.5.3.tar.gz cd apr-util-1.5.3 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-configmake sudo make install
pcreunzip –o pcre-8.34.zip cd pcre-8.34./configure --prefix=/usr/local/pcremakesudo make install
Apachetar –zxvf httpd-2.4.7.tar.gz cd httpd-2.4.7./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcremakesudo make installstart Apache,/usr/local/apache2/bin/apachel start#install mod_wsgi:./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/pythonmake && make installchmod 755 /usr/local/apache2/modules/mod_wsgi.so



###### config apache ####################Listening: 8000LoadModule wsgi_module modules/mod_wsgi.so
ServerName:192.168.1.23:8000

vi /usr/local/apache/conf/extra/httpd-vhosts.conf

Modify wsgi.py



Check the httpd pid





相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.