Maybe I'm missing some step when trying to reproduce the problem, but:
$ lxc launch ubuntu:focal apache2 $ lxc shell apache2 # apt update && apt install -y apache2 # a2dismod mpm_event Module mpm_event disabled. To activate the new configuration, you need to run: systemctl restart apache2 # a2enmod mpm_worker Enabling module mpm_worker. To activate the new configuration, you need to run: systemctl restart apache2 # a2enmod cgi Enabling module cgid. To activate the new configuration, you need to run: systemctl restart apache2 # systemctl restart apache2 # ls -la /run/apache2/ total 4 drwxr-xr-x 2 root root 80 Mar 21 02:28 . drwxr-xr-x 24 root root 760 Mar 21 02:20 .. -rw-r--r-- 1 root root 6 Mar 21 02:28 apache2.pid srwx------ 1 www-data root 0 Mar 21 02:28 cgisock.16732 # cat > /var/www/html/foo.cgi << _EOF_ #!/usr/bin/perl print "Content-type: text/html\n\n"; print "Hello, World."; _EOF_ # chmod +x /var/www/html/foo.cgi # vim /etc/apache2/sites-enabled/000-default.conf ... <Directory "/var/www/html"> Options +ExecCgi AddHandler cgi-script .cgi </Directory> ... :wq # systemctl restart apache2
Then, in another terminal:
$ curl 10.96.142.106/foo.cgi Hello, World.
I'm running:
# apt policy apache2 apache2: Installed: 2.4.41-4ubuntu3.14 Candidate: 2.4.41-4ubuntu3.14 Version table: *** 2.4.41-4ubuntu3.14 500 500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages 100 /var/lib/dpkg/status 2.4.41-4ubuntu3 500 500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
Maybe there's something weird going with the CGI script?
Maybe I'm missing some step when trying to reproduce the problem, but:
$ lxc launch ubuntu:focal apache2 html/foo. cgi << _EOF_ html/foo. cgi sites-enabled/ 000-default. conf
Options +ExecCgi
AddHandler cgi-script .cgi
</Directory>
$ lxc shell apache2
# apt update && apt install -y apache2
# a2dismod mpm_event
Module mpm_event disabled.
To activate the new configuration, you need to run:
systemctl restart apache2
# a2enmod mpm_worker
Enabling module mpm_worker.
To activate the new configuration, you need to run:
systemctl restart apache2
# a2enmod cgi
Enabling module cgid.
To activate the new configuration, you need to run:
systemctl restart apache2
# systemctl restart apache2
# ls -la /run/apache2/
total 4
drwxr-xr-x 2 root root 80 Mar 21 02:28 .
drwxr-xr-x 24 root root 760 Mar 21 02:20 ..
-rw-r--r-- 1 root root 6 Mar 21 02:28 apache2.pid
srwx------ 1 www-data root 0 Mar 21 02:28 cgisock.16732
# cat > /var/www/
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World.";
_EOF_
# chmod +x /var/www/
# vim /etc/apache2/
...
<Directory "/var/www/html">
...
:wq
# systemctl restart apache2
Then, in another terminal:
$ curl 10.96.142. 106/foo. cgi
Hello, World.
I'm running:
# apt policy apache2 archive. ubuntu. com/ubuntu focal-updates/main amd64 Packages security. ubuntu. com/ubuntu focal-security/main amd64 Packages dpkg/status 4.41-4ubuntu3 500 archive. ubuntu. com/ubuntu focal/main amd64 Packages
apache2:
Installed: 2.4.41-4ubuntu3.14
Candidate: 2.4.41-4ubuntu3.14
Version table:
*** 2.4.41-4ubuntu3.14 500
500 http://
500 http://
100 /var/lib/
2.
500 http://
Maybe there's something weird going with the CGI script?