MacOS + apache, CGI scripts give error 304

I am trying to help a colleague get a test setup going to his mac so that he can run CGI scripts. I am a linux guy, and he is not a server guy, so between us we had problems with working with the most basic setup. Here is what we have done so far:

Install / enable apache:

sudo apachectl start

Edit the file /etc/apache2/httpd.confand uncomment this line:

#AddHandler cgi-script .cgi

In the same file, edit the line starting with Optionsand add +ExecCGIto the parameter list.

Install the perl CGI script test.cgi sample in /Library/WebServer/CGI-Executablesand make it executable in the world. Source:

#!/opt/local/bin/perl
print "Content-Type: text/html\n\n";
print "<html> <head>\n";
print "<title>Hello, world!</title>";
print "</head>\n";
print "<body>\n";
print "<h1>Hello, world!</h1>\n";
print "</body> </html>\n";

URL http://localhost/cgi-bin/test.cgi, http- 304, " ". . , - , , , .

apache. , apache script, + ExecCGI, script. , , :

ls -ld /Library/WebServer/CGI-Executables
drwxr-xr-x  7 root  wheel  238 Sep  2 13:58 /Library/WebServer/CGI-Executables
ls -l /Library/WebServer/CGI-Executables/test.cgi 
-rwxr-xr-x  1 root  wheel  343 Sep  2 13:58 /Library/WebServer/CGI-Executables/test.cgi

script , , script, .

- - , ?

+4
1

, ExecCGI /etc/apache 2/httpd.conf - ,

<Directory "/Library/WebServer/CGI-Executables">
  Options ExecCGI
  AddHandler cgi-script .cgi
</Directory>
+1

Source: https://habr.com/ru/post/1654354/


All Articles