[英]Docker httpd apache and getting cgi-bin to execute perl script
New to Docker and trying to get the cgi-bin working in a httpd image. Docker 新手并试图让 cgi-bin 在 httpd 映像中工作。 My Dockerfile is as follows.
我的 Dockerfile 如下。 The SED line adds the perl location to the first line of the example script that comes with the image:
SED 行将 perl 位置添加到图像附带的示例脚本的第一行:
FROM httpd:2.4.46
RUN sed -i '1c#!/usr/bin/perl' /usr/local/apache2/cgi-bin/printenv
I then build and run with:然后我构建并运行:
docker build -t my-apache2 .
docker run -dit --name my-running-app -p 8080:80 my-apache2
I then navigate to localhost:8080/cgi-bin/printenv
but instead of the script executing I get the code displayed as text.然后我导航到
localhost:8080/cgi-bin/printenv
但不是执行脚本,而是将代码显示为文本。 It appears the httpd image comes with ScriptAlias enabled by default. httpd 图像似乎默认启用了 ScriptAlias。 Any ideas please?
请问有什么想法吗?
You also need to enable mod_cgid
您还需要启用
mod_cgid
FROM httpd:2.4.46
RUN sed -i '1c#!/usr/bin/perl' /usr/local/apache2/cgi-bin/printenv
RUN chmod +x /usr/local/apache2/cgi-bin/printenv
CMD httpd-foreground -c "LoadModule cgid_module modules/mod_cgid.so"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.