- 论坛徽章:
- 0
|
问题:通过web可以打开html页面,但是打开*.pl 或者test.cgi时总是提示下载文件,好像程序不会运行?请熟悉apache的大侠帮忙看看
版本:
- root@lhb:/var/www/html/cgi-bin# apachectl -v
- Server version: Apache/2.4.7 (Ubuntu)
- Server built: Jul 22 2014 14:36:39
- root@lhb:/var/www/html/cgi-bin# uname -a
- Linux lhb 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:45 UTC 2014 i686 i686 i686 GNU/Linux
复制代码 apache2的配置文件:
sites-available/000-default.conf
- <VirtualHost *:80>
- ServerAdmin webmaster@localhost
- DocumentRoot /var/www/html
- ErrorLog ${APACHE_LOG_DIR}/error.log
- CustomLog ${APACHE_LOG_DIR}/access.log combined
- Include conf-available/serve-cgi-bin.conf
- </VirtualHost>
复制代码 conf-available/serve-cgi-bin.conf
- <IfModule mod_alias.c>
- <IfModule mod_cgi.c>
- Define ENABLE_USR_LIB_CGI_BIN
- </IfModule>
- <IfModule mod_cgid.c>
- Define ENABLE_USR_LIB_CGI_BIN
- </IfModule>
- <IfDefine ENABLE_USR_LIB_CGI_BIN>
- ScriptAlias /cgi-bin/ /var/www/html/cgi-bin/
- <Directory "/var/www/html/cgi-bin/">
- AllowOverride all
- Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
- Order allow,deny
- Allow from all
- AddHandler cgi-script. .cgi .pl
- # Require all granted
- </Directory>
- </IfDefine>
- </IfModule>
复制代码 文件权限设置的是755
查看日志:
- 127.0.0.1 - - [24/Oct/2014:10:11:59 +0800] "GET /cgi-bin/first.pl HTTP/1.1" 200 362 "-" "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:32.0) Gecko/20100101 Firefox/32.0"
- 127.0.0.1 - - [24/Oct/2014:10:33:28 +0800] "GET /cgi-bin/1.html HTTP/1.1" 200 318 "-" "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:32.0) Gecko/20100101 Firefox/32.0"
复制代码 第一条是浏览器打开first.pl的时候打出来的,结果就是提示下载文件。。。
第二条是打开一个1.html页面,发现可以打开
纠结了好久了,请大家帮忙分析分析 |
|