You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

macOS High Sierra 10.13.3 - apache2 running, httpd not

Numerous sites and pages, including those hosted on Apple here, show how to get, at its most basic level, the most simple set up in the world, the basic apache2 web site on a MacBook Pro. I don't care about anything other than making:


<b> Hi there! </b>


.... show up when I navigate to http://localhost/~tony/main or http://localhost or whatever.


1) when I type: apachectl configtest, it shows AH00112: Warning: DocumentRoot [/usr/docs/dummy-host.example.com] does not exist. The same error is repeated with a -host2 instead of -host, and then it says httpd: Could not reliably determine the server's fully qualified domain name. I don't know what file that "/usr/docs/dummy-host" is being referenced in. From several sites I have closely followed instructions and have uncommented certain lines from various files in /etc/apache2, the /extra directory, things like that.


2) When I type into my Safari browser: http://localhost/~tony I should, as a few people have said, see a file list of the "sites" that I have set up. My directory looks like: /users/tony/Sites/main Under main, there is one file called index.html and inside that is the very basic "Hello World" type of thing. Safari tells me that it can't connect to the local server: localhost.


3) when I type: ps -ef | grep 'httpd' nothing shows up except for the grep process...


I have some very basic experience setting up apache on other platforms; not Mac. There are only a few configuration files touched by me. I am confident that it is a needle in a haystack!


Can anyone out there please help me?

MacBook Pro TouchBar and Touch ID, macOS High Sierra (10.13.3), Apache web server

Posted on Mar 19, 2018 8:52 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 21, 2018 4:30 PM

I finally got this to work. There was an error in the way the log files were referenced in httpd.conf. I had to specify filenames, not folders.


It was very helpful to find out this command:


sudo /usr/sbin/apachectl -k restart


Which returned not only that it wasn't already running (the only command that tells me that), but that it would try to make it run, which it couldn't on account of the error I pointed out above. Now when I issue: ps -ef | grep 'httpd' I have several wonderful processes running. It is great.


Thanks for your attention to this, BobTheFisherMan. I will mark this post as "This solved my question."

Similar questions

14 replies
Question marked as Top-ranking reply

Mar 21, 2018 4:30 PM in response to TonyR_AK

I finally got this to work. There was an error in the way the log files were referenced in httpd.conf. I had to specify filenames, not folders.


It was very helpful to find out this command:


sudo /usr/sbin/apachectl -k restart


Which returned not only that it wasn't already running (the only command that tells me that), but that it would try to make it run, which it couldn't on account of the error I pointed out above. Now when I issue: ps -ef | grep 'httpd' I have several wonderful processes running. It is great.


Thanks for your attention to this, BobTheFisherMan. I will mark this post as "This solved my question."

Mar 19, 2018 9:19 PM in response to TonyR_AK

These are some of what I would guess to be relevant or distantly related settings in the httpd.conf file:


/etc/apache/httpd.conf:


ServerRoot "/usr"


<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>

Listen 8080

</IfDefine>


<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>

Listen 80

</IfDefine>


<Directory />

AllowOverride All

Require all denied

</Directory>


DocumentRoot "/Users/tony/Sites"

<Directory "/Users/tony/Sites">

Options FollowSymLinks Multiviews

MultiviewsMatch Any

AllowOverride All

Require all granted

</Directory>

Mar 20, 2018 9:59 AM in response to BobTheFisherman

Many thanks for your response. Yes, I have read that page (several times) but still nothing is working. At this point, I just want "It Works!" to show up in Safari, but my web browser still reports that it can't connect to server "localhost." I know that this should work. At this point, I will reboot my computer again and see if that works. Thanks again for your response.

Mar 20, 2018 10:02 AM in response to TonyR_AK

You know what would be really stupid is that, maybe, I don't even have apache installed on my computer. Via Google searches, I am not sure I have found a _definitive_ way to ensure that everything is properly installed. Certain directories exist on my computer, like /etc/apache2 and /Library/Webserver/Documents. What else is there that I can check?

Mar 20, 2018 12:21 PM in response to TonyR_AK

I have some improvements, but still Safari still will not show "It Works!" when I navigate to http://localhost or http://localhost/~tony.


At this point, when I enter: sudo apachectl configtest, "Syntax OK" is the only output returned.


I have just spent over an hour going line by line over the above link at https://coolestguidesontheplanet.com/install-apache-mysql-php-and-phpmyadmin-on- macos-high-sierra-10-13/ and it just won't work. Safari reports that it can't connect to the localhost server. This is so frustrating!

Mar 20, 2018 12:25 PM in response to TonyR_AK

What I would do is reinstall your operating system then follow the guide I provided. Do not modify any files such as the hosts file. Do not change the locations of any of the default document root or system files. Apache is installed with the operating system. The guide is very clear on exactly what needs to be configured. Nothing else needs to be done.

Mar 20, 2018 12:36 PM in response to TonyR_AK

I may have stumbled upon my problem. I launched the Activity Monitor, and from the View menu I selected "All Processes," no process that resembles httpd is listed at all.


But, when I type httpd -v at the command line, the following is returned:


Server version: Apache/2.4.28 (Unix)

Server built: Oct 9 2017 19:54:20


Does this indicate a problem? Shouldn't Activity Monitor's "All Processes" show httpd?

Mar 21, 2018 1:10 PM in response to TonyR_AK

Will Apache or httpd show up in Task Manager some place? I have not been able to find it. If it does not show there, is that a good indication that the web server is indeed NOT loading?


Also, when I type: sudo apachectl start it returns: "/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded


If it's already loaded, why doesn't it appear in my Activity Monitor? (I have made sure to look in all areas, like "All Processes," "System Processes," etc. Strange.


(I am trying to avoid the scary prospect of reinstalling my operating system because I have a lot of stuff installed, and everything else works very well.)

macOS High Sierra 10.13.3 - apache2 running, httpd not

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.