1

After spending many hours (no joke) following several "How to install Apache on Sierra" and reading and trying countless questions and answers I've found on the web, Apache still doesn't work. Trying localhost/~myusername I get "This site can’t be reached localhost refused to connect."

sudo apachectl restart seems to work, but has no effect

apachectl configtest produced many different errors that I to the best of my abilities tried to fix, but it didn't fix the problem and the next apachectl configtest produced a different error - and so on...

The latest one:

[Thu Aug 31 23:48:00.748500 2017] [core:warn] [pid 84060] AH00117: Ignoring deprecated use of DefaultType in line 366 of /private/etc/apache2/httpd.conf.
AH00526: Syntax error on line 23 of /private/etc/apache2/extra/httpd-autoindex.conf:
<Directory> directive requires additional arguments

I didn't touch autoindex. I've already lost almost all hope.

On my wife's old desktop with El Capitan I've started Apache, PHP and MySQL in less that half an hour. What is this curse on Sierra?

I suspect I've screwed up majestically somewhere and would be happy to start from the beginning, on clean slate - but have no idea how.

Haven't found usable info on re-installing Apache on the web.

Update: Adding code from httpd.conf that seems to be causing the issue...

# DefaultType: the default MIME type the server will use for a document 
# if it cannot otherwise determine one, such as from filename extensions. 
# If your server contains mostly text or HTML documents, "text/plain" is 
# a good value. If most of your content is binary, such as applications 
# or images, you may want to use "application/octet-stream" instead to 
# keep browsers from trying to display binary files as though they are 
# text.
#
DefaultType text/plain
  • Could you show us line 366 of httpd.conf? And for context perhaps five lines that are before and after that line? – Alistair McMillan Sep 1 '17 at 9:17
  • Actually based on this (gist.github.com/johnfoderaro/14021081b659bca5848df003de577a11) the default httpd.conf file in Sierra (10.12.2 at least) doesn't mention "DefaultType" at all. Did you replace the original file with a conf from a website? – Alistair McMillan Sep 1 '17 at 9:37
  • Line 336 is that has "Default type text/plain" '# DefaultType: the default MIME type the server will use for a document # if it cannot otherwise determine one, such as from filename extensions. # If your server contains mostly text or HTML documents, "text/plain" is # a good value. If most of your content is binary, such as applications # or images, you may want to use "application/octet-stream" instead to # keep browsers from trying to display binary files as though they are # text. # DefaultType text/plain' – Alexei Zoubov Sep 1 '17 at 15:41
  • I've sorry - I never posted here. How do I post code so the formatting is preserved? I followed so many suggestions that now I have several back-ups for – Alexei Zoubov Sep 1 '17 at 15:48
  • If you check the very top of that httpd.conf file I think you'll see lines that hint that the conf file is intended for Apache HTTPD 2.2 while Sierra uses 2.4. My guess is that the problem here is mainly that you have a httpd.conf file intended for an older release. The first step to a fix might be simply to start again with the original httpd.conf file that comes with Sierra. Do you have a copy of the original httpd.conf that was part of the Sierra install? – Alistair McMillan Sep 1 '17 at 15:48

You must log in to answer this question.

Browse other questions tagged .