我的cgi脚本是用Perl(* .cgi)编写的,位于不同的文件夹中。当cgi脚本在浏览器中加载时,会显示实际的脚本而不是HTML。
日志显示:
phpapache_1 | 172.19.20.214 - - [15/Jun/2018:09:51:24 +0000] "GET /blast/blast_link2.cgi HTTP/1.1" 304 181 "http://131.181.10.150:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"
Dockerfile如下所示:
FROM debian:jessie
# based on https://github.com/docker-library/php/blob/master/5.6/jessie/apache/Dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends \
libapache2-mod-perl2 \
libcgi-pm-perl \
php5-cgi \
php5-mysql \
libapache2-mod-php5 \
php5-mysql \
php5-gd && \
rm -rf /var/lib/apt/lists/*
...
COPY apache2-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/apache2-foreground
WORKDIR /var/www/html
RUN /usr/sbin/a2enmod cgi
RUN echo "<Directory /var/www/html/*>" >> /etc/apache2/apache2.conf
RUN echo "Options ExecCGI Includes FollowSymlinks" >> /etc/apache2/apache2.conf
RUN echo "AddHandler cgi-script .pl" >> /etc/apache2/apache2.conf
RUN echo "</Directory>" >> /etc/apache2/apache2.conf
EXPOSE 80
CMD ["apache2-foreground"]
我错过了什么?
提前谢谢
答案 0 :(得分:0)
您是否尝试将RUN echo "AddHandler cgi-script .pl
更改为RUN echo "AddHandler cgi-script .cgi