Ubuntu/16.04LTS+Apache/2.4.18 环境下实现Python CGI编程
来源:互联网 发布:明星网络暴力 编辑:程序博客网 时间:2024/06/09 19:53
菜鸟教程不可谓不简,短短一句话“在你进行CGI编程前,确保您的Web服务器支持CGI及已经配置了CGI的处理程序“估计會使许多菜鸟纠结数天。
通过國内國外和官网各种资料查看,终于把apache2环境配置好了 最起码可以运行python程序。现 以觞大家 分享是美德!
1.安装apache2
sudo apt-get install apache22.编辑apache2.conf配置文件,以上方法安装的apache2没有httpd.conf 配置文件或者为空。请在root情况下打开配置文件
root@x-MacBook:/home/x# vim /etc/apache2/apache2.conf使配置文件修改如下所示:
ScriptAlias /usr/lib/cgi-bin/ "/var/www/cgi-bin/"<Directory "/var/www/cgi-bin/"> AllowOverride None Options +ExecCGI Order allow,deny Allow from all AddHandler cgi-script .cgi .pl .py</Directory><Directory /> Options FollowSymLinks AllowOverride None Order deny,allow allow from all</Directory><Directory /usr/share> AllowOverride None Require all granted</Directory><Directory /var/www/cgi-bin> Options Indexes FollowSymLinks AllowOverride None Require all granted</Directory>#<Directory /srv/># Options Indexes FollowSymLinks# AllowOverride None# Require all granted#</Directory>ServerName lacalhost:80 # 这句最好放整个配置文件的最下面
3.接着编辑000-default.conf配置文件 这个配置文件存在于 /etc/apache2/sites-avaibable/和 /etc/apache2/sites-enabled/目录中,且存在于 /etc/apache2/sites-avaibable/中没用,必须通过 ln -s 命令关联到 /etc/apache2/sites-enabled/中
vim /etc/apache2/sites-avaibable/000-default.conf配置好如下:
<VirtualHost *:80># The ServerName directive sets the request scheme, hostname and port that# the server uses to identify itself. This is used when creating# redirection URLs. In the context of virtual hosts, the ServerName# specifies what hostname must appear in the request's Host: header to# match this virtual host. For the default virtual host (this file) this# value is not decisive as it is used as a last resort host regardless.# However, you must set it for any further virtual host explicitly.#ServerName www.example.comServerAdmin webmaster@localhostDocumentRoot /var/www/cgi-bin <Directory "var/www/cgi-bin"> AllowOverride None Options Indexes FollowSymLinks ExecCGI Order allow,deny Allow from all AllowOverride All </Directory># Available loglevels: trace8, ..., trace1, debug, info, notice, warn,# error, crit, alert, emerg.# It is also possible to configure the loglevel for particular# modules, e.g.#LogLevel info ssl:warnErrorLog ${APACHE_LOG_DIR}/error.logCustomLog ${APACHE_LOG_DIR}/access.log combined# For most configuration files from conf-available/, which are# enabled or disabled at a global level, it is possible to# include a line for only one particular virtual host. For example the# following line enables the CGI configuration for this host only# after it has been globally disabled with "a2disconf".Include conf-available/serve-cgi-bin.conf</VirtualHost># vim: syntax=apache ts=4 sw=4 sts=4 sr noet
4.
/etc/init.d/apache2 reload
/etc/init.d/apache2 start
剩下的就可以参考菜鸟教程啦,等有闲情再来改
阅读全文
0 0
- Ubuntu/16.04LTS+Apache/2.4.18 环境下实现Python CGI编程
- Windows下搭建Apache+python+cgi环境
- windows下搭建python cgi编程环境
- windows7平台下配置Apache+Python-CGI开发运行环境
- ubuntu 下搭建cgi环境
- python CGI 编程环境搭建
- Ubuntu+Apache上搭建CGI开发环境
- ubuntu 实现apache2+python+cgi
- win7环境下安装Ubuntu kylin 16.04 Lts
- Ubuntu 16.04 LTS下安装配置Java环境
- 在Ubuntu 16.04 LTS环境下安装L4RE和Fiasco
- Ubuntu 16.04 LTS下用apt搭建LAMP环境
- ubuntu下apache+C语言+CGI配置
- Ubuntu 14.04 LTS 搭建Swift编程环境
- python cgi编程 windows安装Apache
- Ubuntu 14.04 LTS下安装 LNMP环境
- Ubuntu 14.04 LTS下安装 LNMP环境
- Ubuntu 14.04 LTS下安装 LNMP环境
- [USACO1.4]母亲的牛奶Mother's Milk dfs
- HashMap源码剖析
- 小波变换中的信号扩展(延拓)问题
- 分治法的概念以及应用
- java鬼混笔记:redis 3、java下使用redis,自定义一个工具类RedisUtil
- Ubuntu/16.04LTS+Apache/2.4.18 环境下实现Python CGI编程
- miniUI的datagrid表格编辑时将原有的值带出来的技巧
- ArrayList源码剖析
- 第十七章经典抽象数据类型(一)
- 机器学习笔记一
- 一个遍历文件夹内容,显示文件名,大小等信息的MFC程序
- 新一代分布式服务框架:服务网格servicemesh
- very_overflow的wp
- LinkedList源码剖析