Linux+apache+mysql+python+mod_第1頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余2頁(yè)可下載查看

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、linux+apache+mysql+python+modlinux+apache+mysql+python+mod_python+django 解釋:系統(tǒng)rhel 5.3,默認(rèn)安裝、mysql,沒(méi)有安裝的,請(qǐng)下載安裝rpm包,刪除/etc/httpd/moles/mod_python.so,假如有的話。 一、安裝python 1 wget /python/2.7.1/python-2.7.1.tgz 2 tar xfz mod_python-2.7.11.tgz 3 python-2.7.11 安裝./config -prefix=/usr/local

2、/python/ make make install 4 -s /usr/local/python/bin/python2.7 /usr/bin/ 5 ln -s /usr/local/python/bin/python/usr/bin/ 二、安裝 wget /packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.eggmd5=fe1f997bc722265116870bc7919059ea 1 sh setuptools-0.6c11-py2.7.egg 2 ldconfig 讓它生效 三、安裝 mysq

3、ldb模塊 wget http:/cdnetworks-kr- 1 tar zxvf mysql-python-1.2.3.tar.gz 2 cd mysql-python 3python2.7 setup.py build ln -s /usr/local/python/bin/python2.7 /usr/bin/(注重建立銜接) 4 python2.7 setup.py install 安裝 5測(cè)試: rootlocalhost conf python2.7 python 2.7.1 (r271:86832, mar 21 2011, 10:13:38) gcc 4.1.2 200807

4、04 (r hat 4.1.2-44) on linux2 type help , copyright , credits or license for infoation. import mysqldb 沒(méi)有提醒解釋是正確的。 四、安裝mod_python wget /dist/httpd/modpython/mod_python-3.3.0b.tgz 1 安裝前安裝apr-devel-1.2.7-11.el5_5.2.i386.rpm、apr-util-devel-1.2.7-7.sel5_3.2.i386.rpm、httpd-devel-2

5、.2.4.el5.centos.i386.rpm,由于要?jiǎng)討B(tài)加入python模塊,要不然找不到apxs 2 tar xvf mod_python-3.3.0b.tgz 3cd mod_python-3.3.0b 4 ./configure -with-apxs=/usr/sbin/apxs -with-python=/usr/local/python/bin/python (apache支持python) 5 make make install 6 注重 loadmodule python_module modules/mod_python.so這個(gè)不用添加,由于在/etc/httpd/con

6、f.d/python.conf 已經(jīng)配置好 7ervice httpd restart (重啟下apache) 8 測(cè)試: rootlocalhost conf python python 2.7.1 (r271:86832, mar 21 2011, 10:13:38) gcc 4.1.2 20080704 (red hat 4.1.2-44) on linux2 type help , copyright , credits or license for more information. import mod_python 五、安裝django wget 1 tar xfz django

7、-1.2.5.tar.gz 2 cd django-1.2.5 3 python2.7 setup.py install 4測(cè)試: rootlocalhost conf python python 2.7.1 (r271:86832, mar 21 2011, 10:13:38) gcc 4.1.2 20080704 (red hat 4.1.2-44) on linux2 type help , copyright , credits or license for more information. import django 六、測(cè)試所有 1 mkdr /www 2cd /www 3/us

8、r/local/python/bin/django-admin.py startproject mytest 4 cd mytest 5python manage.py runserver :8000 6 效果如下: 650) this.wth=650;" alt="" src="/uploads/allimg/111214/125z0c49-0.png" width="600" height="336" /> 掃瞄器拜訪: 650) this.width=650;" alt

9、="" src="/uploads/allimg/111214/125z040r-1.png" width="600" height="336" /> 7 crtl+c退出 七、配置apache虛擬名目(虛擬名目有兩種,一種是基于名目,另一種是基于域名) 1基于虛擬名目 vi /etc/httpd/conf/httpd.conf 添加以下配置文件: alias /python /www directory /www allowoverride fileinfo ahandler mod_python .py

10、pythonhandler test pythondebug on /directory service httpd restart(記得重啟) 在/www名目下面的test.py寫(xiě)入: from mod_python import apache def handler(req): req.( hello world! ) return apache.ok 在掃瞄器拜訪: 650) this.width=650;" alt="" src="/uploads/allimg/111214/125z01110-2.png" width="6

11、00" height="336" /> 2虛擬主機(jī)基于域名拜訪: 1 vi /etc/httpd/conf/httpd.conf namevirtualhost *:80去掉注釋 添加如下配置: virtualhost *:80 serveradmin admin documentroot /www servername directory /www allowoverride fileinfo addhandler mod_python .py pythonhandler test pythondebug on options indes followsymlinks multiviews allowoverride all order allow,deny allow from all /directory /virtualhost service httpd restart(記得重啟) 修改下本地hosts文件ip映射成 掃瞄器拜訪: 650) thi

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論