Here is a post that was on the QNA list a few years ago about the necessary edits to the httpd.conf file to enable internet sharing and/or publishing:
Starting with OS X 10.10, Apple changed the web server configuration so that CGI programs are disabled. I guess they thought that was a potential security issue, but they didn’t care that people were actually using that feature!
To get it working again, you have to edit the httpd.conf file, which is found at:
/private/etc/apache2/httpd.conf
It’s kind of difficult to edit this text file, because it is in a protected location. I use BBEdit to do this, it has the ability to prompt you for the system password and allow you to edit the file.
Once you have the file open, you’ll need to find this section:
<Directory "/Library/WebServer/CGI-Executables">
... configuration options
</Directory>
You’ll need to change the options to the ones shown below:
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None"
AddHandler cgi-script .cgi .pl .tcl .py"
Options +ExecCGI"
Require all granted"+ </Directory>
You will also need to find this line:
#LoadModule cgi_module libexec/apache2/mod_cgi.so
Remove the leading # sign, so it looks like this:
LoadModule cgi_module libexec/apache2/mod_cgi.so
Once you’ve made these changes, save the file, then start up Apache again (if you didn’t do so before, stop it before you restart it).
Hopefully at this point it will start working.