我像这样为apache编译了我的fcgi:
g++ fcgistart.c -lfcgi
我得到了一个a.out
并使用 apache 对其进行配置
a2enmod fastcgi
现在我读了手册
分配给处理程序 fcgid 脚本的任何程序都使用 FastCGI 协议进行处理;
这是否意味着二进制文件是一个脚本?雷德!无论如何,我将a.out
放在/var/www/html
.
因为处理程序(/etc/apache2/mods-enabled/fastcgi.conf(绑定到.fcgi
我a.out
复制到a.fcgi
。现在我浏览到http://localhost/a.fcgi
和403禁忌的八角。
xx@xx:/var/www/html$ ls -la
drwxr-xr-x 2 root root 4096 Feb 6 13:44 .
drwxr-xr-x 3 root root 4096 Feb 6 12:56 ..
-rwxr-xr-x 1 root root 8696 Feb 6 13:44 a.fcgi
-rwxr-xr-x 1 root root 8696 Feb 6 13:16 a.out
-rw-r--r-- 1 root root 11321 Feb 6 12:57 index.html
怎么了?
我明白了:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
错了,我不得不添加ExecCGI
选项:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options +ExecCGI
</Directory>
</VirtualHost>