3

I have failed for a year to find a way to run SSI (server side includes) on my iMac using the apache web server included with server.app.

I am wondering if the server app will allow server-side includes in a website hosted by Apache on High Sierra?

1

No. In fact, Apple is removing the web server functionality from server app entirely in the very near future and documenting how you would migrate your data to apache to serve web pages.

The PDF above has pages 22 to 32 dedicated to how you would migrate any data to an open-source web server. If you like apache, the homebrew tool might be a good one to use for managing that install and patching and service state (stop / start / restart the web server on command or boot).

From there, you'd be on your own (or need to ask a flown question - possibly on another site about how to enable the SSI you want on the version of the web server you have chosen).

  • Is homebrew the best here as apache would be better running as its own user not the installer – user151019 Aug 31 '18 at 21:55
  • That’s a very good point @Mark I did qualify might be good for installing, patching and service control. Should I have said beginner use? I don’t know anyone that’s super technical that used server app so I kind of geared for the first couple times someone sets this up. – bmike Aug 31 '18 at 22:59
0

I just got this working today. I was not using the macOS Server app. However, my system had apache 2.4 on it already. I'm running macOS 10.13.5 (17G65) aka High Sierra.

I first had to follow the instructions here to get the server running. Note that I didn't bother with the PHP section because I don't need that functionality, and I didn't bother setting up multiple sites, either. So it basically involved putting an index.html file into my ~/Sites directory, which already existed.

Next I configured apache as described in section 3 of the above document. I created the /etc/apache2/users/myusername.conf and added the following:

<Directory "/Users/username/Sites/">
  AllowOverride All
  Options Includes Indexes MultiViews FollowSymLinks
  Require all granted
</Directory>

Note the extra Includes in the Options section. That is the first requirement to get server-side includes working. Note also that if you write +Includes as suggested in the apache docs, it will silently fail. This is what happened to me. Either all of the options have to have the + symbol or none of them can have it.

Next I edited /etc/apache2/httpd.conf in the following ways:

  1. Uncommented the line for module_include:

    LoadModule include_module libexec/apache2/mod_include.so

  2. Uncommented the other modules suggested in the above docs:

    LoadModule authz_host_module libexec/apache2/mod_authz_host.so

    LoadModule authz_core_module libexec/apache2/mod_authz_core.so

    LoadModule userdir_module libexec/apache2/mod_userdir.so

    LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

    Include /private/etc/apache2/extra/httpd-userdir.conf

    Include /private/etc/apache2/extra/httpd-vhosts.conf

  3. Found and uncommented these lines:

    AddType text/html .shtml

    AddOutputFilter INCLUDES .shtml

That says that .shtml files will be processed for server-side-includes

I believe that's all I did. Note that you can look in Console.app under the section /var/log. If you twirl that open, there's another folder inside named apache2. If you click on that, there are several apache logs. As mentioned above, they are sparse and don't tell you every error that occurred, but do tell you some. I eventually discovered the problem by doing:

apachectl -M

and seeing that there were errors on the output of that command that led to the exact line in the config files that were bad. That was much more helpful!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .