配置Apache指定任意文件夹运行perl

1、编辑Apache配置文件httpd.conf,加入如何代码:

  1. AddHandler cgi-script .cgi
  2. AddHandler cgi-script .pl

2、设置根目录的perl执行权限。

  1. <Directory /home/user/public_html/>
  2.         Options Indexes FollowSymLinks MultiViews
  3.         AllowOverride All
  4.         Order allow,deny
  5.         allow from all
  6. </Directory>

找到

  1. Options Indexes FollowSymLinks MultiViews

替换为

  1. Options All

3、虚拟主机配置例子

  1. <VirtualHost 67.228.104.123:80>
  2. DocumentRoot /var/www/cgi-bin/
  3. ServerName git.bizhat.com
  4. CustomLog /var/log/httpd/git.bizhat.com.log combined
  5. AddHandler cgi-script .cgi
  6. <Directory "/var/www/cgi-bin/">
  7.     AllowOverride None
  8.     Options All
  9.     Order allow,deny
  10.     Allow from all
  11. </Directory>
  12. </VirtualHost>
标签:Apache 发布于:2019-10-05 17:32:32