搭建简易的c语言与python语言CGI和Apache服务器的开发环境

时间:2022-03-18 04:17:36

搭建简易的c语言CGI和Apache服务器的开发环境

http://www.cnblogs.com/tt-0411/archive/2011/11/21/2257203.html

python配置apache的web服务器方法(python的CGI配置)

http://www.cnblogs.com/zhidong123/p/6491938.html?utm_source=itdadao&utm_medium=referral

Nginx + CGI/FastCGI + C/Cpp

http://www.cnblogs.com/skynet/p/4173450.html

解决python中文 乱码问题

在客户端utf-8显示为乱码

在中文网页请中依情况在标签中添加:

GB2312 (简体中文):

print ("Content-type:text/html;charset="gb2312"\n\n")



< META http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />

#!D:\Program Files\Python\Python36\python.exe
# -*- coding: utf-8 -*-
print ("Content-type:text/html;\n\n")
print ("") # 空行,告诉服务器结束头部
print ('<html>')
print ('<head>')
print ('<meta charset="gb2312">')
print ('<title>Hello Word - 我的第一个 CGI 程序!</title>')
print ('</head>')
print ('<body>')
print ('<h2>Hello Word! 我是CGI程序</h2>')
print ('</body>')
print ('</html>')

httpd.conf 中的核心配置

<Directory "D:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
# Options None
Options Indexes FollowSymLinks ExecCGI
# Require all granted
</Directory>
AddHandler cgi-script .exe .pl .cgi .py