yum 安装apcche
【apache】yum 安装Apache(Centos 6.9) https://www.cnblogs.com/lauren1003/p/5993654.html
只需一行命令:
yum instal httpd -y #安装
service httpd start #启动apache
apache的参数和路径说明:https://blog.csdn.net/shj_php/article/details/79495861
apache的CGI参数配置 https://www.cnblogs.com/myvic/p/6821368.html
Python CGI编程:http://www.runoob.com/python/python-cgi.html
配置过程:
vi /etc/httpd/conf/httpd.conf
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务
#!/usr/bin/python2.6
# -*- coding: UTF-8 -*-
print "Content-type:text/html"
print # 空行,告诉服务器结束头部
print '<html>'
print '<head>'
print '<meta charset="utf-8">'
print '<title>Hello World - 我的第一个 CGI 程序!</title>'
print '</head>'
print '<body>'
print '<h2>Hello World! 我是来自菜鸟教程的第一CGI程序</h2>'
print '</body>'
print '</html>'
if version_info<(3,0):
print('注意当前是:python2')
else:
print('python3')
服务目录 /etc/httpd
主配置文件 /etc/httpd/conf/httpd.conf
网站数据目录 /var/www/html
访问日志 /var/log/httpd/access_log
错误日志 /var/log/httpd/error_log