Issue
In trying to resolve a path error on my cgi-bin, I've discovered that Apache is looking for it in the wrong place.
The error log shows: script not found or unable to stat: /Library/Server/Web/Data/CGI-Executables
But my httpd.conf file has:
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Require all granted
</Directory>
Those paths were in the httpd.conf by default. There is no reference of any sort in to /Library/Server/Web/Data in the httpd.conf
If I move the whole CGI-Executables directory to /Library/Server/Web/Data/ everything works. That's good, but I want it to be /Library/WebServer/
What would cause Apache to ignore the httpd.conf assigned path and how can I correct it?
Solution
SOLVED This one is a big shortcoming on Apple's part.
Under the heading of Work with Apache, OS X Server Documentation shows cgi as served from /Library/WebServer/CGI-Executables/. And sure enough, there's a CGI-Executables folder right where they said it should be.
In OS X Server's Help module, for cgi info, it links you to the Apache tutorial on .htaccess files. There you can learn to edit the htaccess to provide Apache with your desired paths. But it never works.
What Apple never gets around to sharing is that OS X Server has it's own special config file: httpd_server_app.conf. You'll find information about it in a Read Me.txt located inside /Library/Server/Web/Config/apache2/. It's the sole reference I've found to the httpd_server_app.conf which is the only reference to the non-existant /Library/Server/Web/Data/CGI-Executables directory.
So, the solution for cgi-bin URLs on OS X Server is to either create a new folder /Library/Server/Web/Data/CGI-Executables for your cgi scripts. Or edit the cgi ScriptAlias and Directory paths to match what you would prefer such as /Library/WebServer/CGI-Executables which Apple refers to everywhere else.
Answered By - JAC