简体   繁体   中英

Perl cgi does work in apache2

My cgi scripts are written in Perl (*.cgi) and are located in different folders. When the cgi script gets loaded inside the browser the actual scripts appears rather than HTML.

The log shows:

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"

The Dockerfile looks like this:

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"]

What did I miss?

Thank you in advance

您是否尝试过将RUN echo "AddHandler cgi-script .pl更改为RUN echo "AddHandler cgi-script .cgi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM