• 搭建服务器


    零基础搭建服务器

      apache下载安装

        我用的是Ubuntu,所有 sudo apt-get install apache2 (配置PHP的时候已经配好了,这里就不重复配置了)

      安装Apxs

        安装过PHP,所以这个也忽略掉 sudo apt-get install apache2-dev

         apxs是一个为Apache超文本传输协议(HTTP)服务器编译安装扩展模块的工具,

        由于下一步的mod配置需要apxs的路径。以前安装的时候不知道这个路径在什么地方。

        /usr/bin/apxs2 ???

    列的软件包有不能满足的依赖关系:libgnomeprint2.2-dev: 依赖: libpango1.0-dev 但是它将不会被安装  
    
    2008-07-31 06:04:31|  分类: linux技术 |举报|字号 订阅
    晕了。在GOOGLE大叔上找了很久,
    终于找到一个解决办法:
    就是把:sudo apt-get install 换成 sudo aptitude install
    原来aptitude和apt-get一样。看下介绍
    
    aptitude 与 apt-get 一样,是 Debian 及其衍生系统中功能极其强大的包管理工具。与 apt-get 不同的是,aptitude 在处理依赖问题上更佳一些。举例来说,aptitude 在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。以下是笔者总结的一些常用 aptitude 命令,仅供参考。
    
    命令    作用
    aptitude update    更新可用的包列表
    aptitude upgrade    升级可用的包
    aptitude dist-upgrade    将系统升级到新的发行版
    aptitude install pkgname    安装包
    aptitude remove pkgname    删除包
    aptitude purge pkgname    删除包及其配置文件
    aptitude search string    搜索包
    aptitude show pkgname    显示包的详细信息
    aptitude clean    删除下载的包文件
    aptitude autoclean    仅删除过期的包文件
    也可以在文本界面模式中使用 aptitude。
    View Code

      安装mod_python

        进官网下载 http://modpython.org/

        得到 mod_python-2.7.10.tgz

        解压

          tar xvfz mod_python-2.7.10.tgz

        编译

        ./configure --with-apxs=/usr/bin/apxs2  --with-python=/usr/bin/python2.7

        make 报错 apr.h:没有那个文件或目录 编译中断。

        安装

        手动安装不了,这个问题卡住了。

        #sudo aptitude install libapache2-mod-python

        apache配置:

     1 #错误的配置
     2 <Directory "/var/www/python/">
     3     AllowOverride FileInfo
     4     AddHandler mod_python .py 
     5     PythonHandler index
     6     PythonDebug On
     7     Order allow,deny
     8     Allow from all
     9 </Directory>
    10 
    11 #正确的配置
    12 <Directory "/var/www/python/">
    13     AllowOverride FileInfo
    14     AddHandler python_program .py 
    15     PythonHandler index
    16     PythonDebug On
    17     Order allow,deny
    18     Allow from all
    19 </Directory>
    http.conf

        AddHandler python-program .py #py解释器
        PythonHandler mptest #启动的文件名mptest.py
        PythonDebug On #诊断

    在 /var/www/python目录下新建一个文件 为 mptest.py

    1 from mod_python import apache
    2 
    3 def handler(req):
    4     req.log_error('handler')
    5     req.content_type = 'text/html'
    6     req.send_http_header()
    7     req.write('Hello World')
    8     return apache.OK
    mptest.py

    配置到此为止。

  • 相关阅读:
    [Swift通天遁地]三、手势与图表-(9)制作五彩缤纷的气泡图表
    hdu2289 Cup(二分)
    Makefile学习(三)[第二版]
    CABasicAnimation 基本动画
    iOS_20_微博自己定义可动画切换的导航控制器
    yispider 开源小说採集器 (来源http://git.oschina.net/yispider/yispider 我的改动版由于他的我无法跑)
    谈谈C++私有继承
    深入struts2.0(七)--ActionInvocation接口以及3DefaultActionInvocation类
    STL 之 list源码自行实现(iterator)
    二分lower_bound()与upper_bound()的运用
  • 原文地址:https://www.cnblogs.com/canbefree/p/3782507.html
Copyright © 2020-2023  润新知