CGI 脚本从 Web 返回 500 内部服务器错误,尽管从命令行工作

CGI script return 500 Internal Server Error from web, although work from command line

提问人:Qompass 提问时间:7/15/2023 最后编辑:Qompass 更新时间:7/16/2023 访问量:90

问:

操作系统: AlmaLinux 8.8.服务器版本:Apache/2.4.37 (AlmaLinux)。命令:返回:perl /home/user1/public_html/test.cgi

Content-type:text/html

Hello!

文件属性:-rwxr-xr-x. 1 nobody nobody unconfined_u:object_r:httpd_sys_script_exec_t:s0 88 Jul 15 12:57 test.cgi

但是,当您尝试从 Web 运行它时,就像 example.com/test.cgi 一样,您收到以下错误:[Sat Jul 15 13:38:50.943316 2023] [cgid:error] [pid 2099193:tid 140664406800128] [client 172.71.182.34:24506] AH01241: error spawning CGI child: exec of '/home/user1/public_html/test.cgi' failed (No such file or directory): /home/user1/public_html/test.cgi [Sat Jul 15 13:38:50.943677 2023] [cgid:error] [pid 2099193:tid 140664406800128] [client 172.71.182.34:24506] End of script output before headers: test.cgi

文件存在:

stat /home/user1/public_html/test.cgi
  File: /home/user1/public_html/test.cgi
  Size: 88              Blocks: 8          IO Block: 4096   regular file
Device: fd02h/64770d    Inode: 9729        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1003/  user1)   Gid: ( 1003/  user1)
Context: unconfined_u:object_r:httpd_sys_script_exec_t:s0
Access: 2023-07-15 12:57:07.393297167 +0300
Modify: 2023-07-15 12:57:01.240297226 +0300
Change: 2023-07-15 13:51:06.171266280 +0300
 Birth: 2023-07-15 12:57:01.240297226 +0300

SELinux 处于宽松模式:

getenforce
Permissive

请帮忙找出是什么阻止了 test.cgi 的运行?先谢谢你。

我已经检查过,防火墙中允许使用 http 和 https。

Apache HTTP CGI 防火墙 almalinux

评论


答: 暂无答案