“Set up CGI with Apache on kali Linux”的版本间的差异
跳到导航
跳到搜索
(→py相关) |
(→py相关) |
||
第87行: | 第87行: | ||
[https://blog.csdn.net/ma7986321/article/details/80669171?utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control 用python -m http.server搭一个简易的本地局域网] | [https://blog.csdn.net/ma7986321/article/details/80669171?utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control 用python -m http.server搭一个简易的本地局域网] | ||
+ | |||
+ | [https://www.cnblogs.com/windlaughing/p/3153848.html python实现基于CGI的Web应用] | ||
[https://blog.csdn.net/u013904227/article/details/52331438 一个支持 cgi 的简易 http 服务器] | [https://blog.csdn.net/u013904227/article/details/52331438 一个支持 cgi 的简易 http 服务器] | ||
+ | |||
+ | [https://blog.csdn.net/whahu1989/article/details/102221777 使用Python3简单运行CGI Web Server] | ||
+ | |||
+ | https://docs.python.org/zh-cn/3.9/library/http.server.html | ||
==install== | ==install== |
2021年5月22日 (六) 02:10的版本
[[category:]]
ins httpd
sudo apt-get install apache2
config
理论上只动这两个配置 /etc/apache2/apache2.conf /etc/apache2/conf-available/serve-cgi-bin.conf mkdir /var/www/cgi-bin cd /var/www/cgi-bin/ sudo vi /etc/apache2/apache2.conf 并在末尾添加以下内容 ################################################################### ######### Adding capaility to run CGI-scripts ################# ServerName localhost ScriptAlias /cgi-bin/ /var/www/cgi-bin/ Options +ExecCGI AddHandler cgi-script .cgi .pl .py sudo vi /etc/apache2/conf-available/serve-cgi-bin.conf #修改成如下所示: 原来的最好backup <IfModule mod_alias.c> <IfModule mod_cgi.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_cgid.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfDefine ENABLE_USR_LIB_CGI_BIN> #ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ #<Directory "/usr/lib/cgi-bin"> # AllowOverride None # Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch # Require all granted #</Directory> ## cgi-bin config ScriptAlias /cgi-bin/ /var/www/cgi-bin/ <Directory "/var/www/cgi-bin/"> AllowOverride None Options +ExecCGI </Directory> </IfDefine> </IfModule> 使用以下命令启用CGI模块。此命令创建模块配置文件到/etc/apache2/mod-enabled/ 目录下的软链接。 sudo a2enmod cgi udo service apache2 restart cd /var/www/cgi-bin touch hello.py chmod o+x hello.py sudo vi hello.py #cgi等等文件名也行 #!/usr/bin/python3 print("Content-Type: text/html;charset=utf-8") print () print ("你好啊,evan") 打开浏览器 IP/cgi-bin/hello.py
see also
py相关
用python -m http.server搭一个简易的本地局域网
https://docs.python.org/zh-cn/3.9/library/http.server.html