简体   繁体   English

配置Apache2以允许客户端在cgi-bin中运行Perl脚本

[英]Configure Apache2 to allow clients to run Perl Scripts in cgi-bin

I have two perl scripts; 我有两个perl脚本; one acts like the client (and queries); 一个像客户端(和查询)一样工作; the other acts like the server and returns information. 另一个就像服务器一样,并返回信息。 On an Apache server (not my own) they work perfectly. 在Apache服务器(不是我自己的服务器)上,它们可以正常工作。

However, on my ubuntu/Linux_box with Apache2 (that I set up) they do not; 但是,在我使用Apache2(我设置)的ubuntu / Linux_box上,它们却没有; I get a 404 not found error. 我收到404未找到错误。 The cgi-bin directory is located at usr/lib/cgi-bin. cgi-bin目录位于usr / lib / cgi-bin。 What specific files/settings etc have to be changed/altered/etc. 哪些特定的文件/设置等必须更改/更改/等。 And, what specific changes/alterations/etc. 并且,什么具体的更改/更改/等。 need to be made? 需要做?

Edit: I changed the httpd.conf and tried both of the following (but neither worked): 编辑:我更改了httpd.conf并尝试了以下两种方法(但均无济于事):

ScriptAlias  /diag/ /usr/lib/cgi-bin
ScriptAlias  /diag/ /usr/lib/cgi-bin/

I am using a perl script as the client, and it did not work. 我使用的是Perl脚本作为客户端,但无法正常工作。 For illustration purposes I attempted to locate the file with the browser shown in the 2nd pic. 为了便于说明,我尝试使用第二张图片中所示的浏览器定位文件。

linux

女士

If they are receiving 404, it means that the file does not even exist in the correct location. 如果他们正在接收404,则意味着该文件甚至不存在于正确的位置。 In the httpd.conf look for the "ScriptAlias" directive that has an entry for cgi-bin, should be something like 在httpd.conf中,查找具有cgi-bin条目的“ ScriptAlias”指令,应类似于

ScriptAlias /cgi-bin/ /some_folder/cgi-bin ScriptAlias / cgi-bin / / some_folder / cgi-bin

Once you know the correct folder, the 404 error should go away. 知道正确的文件夹后,404错误就会消失。

Two other points - 1. For cgi files, ensure that the execute bit is set. 另外两点-1.对于cgi文件,请确保将execute位设置为1。 2. Verify that the location of perl matches the one in the perl script. 2.验证perl的位置是否与perl脚本中的位置匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何允许perl cgi-bin脚本运行系统命令? - How to allow perl cgi-bin script to run system commands? Virtualhosts cgi-bin中的Perl文件始终会下载(Debian 6和Apache2) - Perl files in Virtualhosts cgi-bin are always downloaded (Debian 6 and Apache2) Apache Perl cgi-bin设置:内部服务器错误 - Apache Perl cgi-bin setup: Internal Server Error Docker httpd apache 并让 cgi-bin 执行 perl 脚本 - Docker httpd apache and getting cgi-bin to execute perl script 如何配置 Apache 2 以运行 Perl CGI 脚本? - How do I configure Apache 2 to run Perl CGI scripts? Perl cgi-bin自动完成 - Perl cgi-bin auto complete 在Windows 7上找不到Apache的“ cgi-bin”目录 - “cgi-bin” directory for Apache not found on windows 7 如何从Perl或PHP(在Linux上使用Apache的CGI-BIN)调用c ++二进制文件? - How to call c++ binary from Perl or PHP (CGI-BIN using Apache on Linux )? 当用作cgi-bin时,如何使用setuid()成功运行Perl脚本? - How to successfully run Perl script with setuid() when used as cgi-bin? 如何在Ubuntu 10.04的“ root-directory / cgi-bin”中的“ root-directory / sub-directory / cgi-bin”中设置服务器以运行perl脚本? - How to set server to run the perl script in “root-directory/sub-directory/cgi-bin” from “root-directory/cgi-bin” in Ubuntu 10.04?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM