apache+perl+cgi on termux

[japanese(日本語)]

 

1.Install temrux

Install termux on PlayStore.

 

2.install apache,perl

apt update
apt upgrade
apt install apache2
apt install perl

 

3. modify httpd.conf

file:/data/data/com.termux/files/usr/etc/apache2/httpd.conf

<Directory /data/data/com.termux/files/usr/lib/cgi-bin>
</Directory>

Add options to the  above section as follows.

Options +ExecCGI

 

uncomment the following line.

AddHandler cgi-script .cgi

 

modify httpd.conf  to load mod_cgi module as follows.

<IfModule mpm_prefork_module>
    #LoadModle cgi_module libexec/apache2/mod_cgi.so
</IfModule>

#<IfModule mpm_prefork_module>
    LoadModle cgi_module libexec/apache2/mod_cgi.so
#</IfModule>

 

4. confirmation (confirm to work printenv)

4.1. add execute permisision

chmod ugo+x /data/data/com.termux/files/usr/lib/cgi-bin/printenv

4.2.add the line as follows into printenv

#!/usr/bn/perl

 

5. start apache

apachectl

 

6. access to the local web server on android as follows.

http://localhost:8080/

http://localhost:8080/cgi-bin/printenv