1、编辑Apache配置文件httpd.conf,加入如何代码:
- AddHandler cgi-script .cgi
- AddHandler cgi-script .pl
2、设置根目录的perl执行权限。
在
- <Directory /home/user/public_html/>
- Options Indexes FollowSymLinks MultiViews
- AllowOverride All
- Order allow,deny
- allow from all
- </Directory>
找到
- Options Indexes FollowSymLinks MultiViews
替换为
3、虚拟主机配置例子
- <VirtualHost 67.228.104.123:80>
- DocumentRoot /var/www/cgi-bin/
- ServerName git.bizhat.com
- CustomLog /var/log/httpd/git.bizhat.com.log combined
- AddHandler cgi-script .cgi
- <Directory "/var/www/cgi-bin/">
- AllowOverride None
- Options All
- Order allow,deny
- Allow from all
- </Directory>
- </VirtualHost>