I’m branching out from Win/IIS to include OSX/Apache (Yosemite). I’ve been doing well so far (amazed at how much command line knowledge you need, but still loving the exploration process). Sadly, even after 4 different articles, I cannot get Apache to serve content.
I have my “web root” (IIS term) located at ~/Server/web. In there, I made 2 folders: localhost and com.example (I name my site folders backwards, that represents the site root for ‘example.com’), and also, when testing locally, I change the ‘com’ TLD to ‘dev’. So on my machine, I’d either goto http://localhost or http://example.dev to get to these 2 sites.
I created a folder ~/Hosts which contains a file: hosts.conf. In it, I have mapped:
127.0.0.1 localhost
127.0.0.1 example.dev
I then modified: /etc/apache2/httpd.conf and did an include to the hosts file: /Users/[username]/Hosts/*
The 1 file in that folder has 2 entries in the format:
Also, in httpd.conf, I changed the DocumentRoot variable:
DocumentRoot “/Users/[username]/Server/web”
<Directory “/Users/[username]/Server/web”>
…
After all was said and done, I did a:
sudo apachectl start
And navigated out to http://localhost (which I placed a index.html in) and http://example.dev (same). Neither would load up. Network connection error. I can ping both addresses, and they come back as 127.0.0.1.
Also, I cannot confirm that Apache is running (can’t find such a command) I expected some ‘httpd’ process to be running, and check in OS X, but so such process showed. I apologize for the long post, but hopefully someone with Apache/OS X experience can give a fellow developer a hand. I’ve been on this for 2 days now and I think it’s time to get a fresh pair of eyes on the problem. Thanks.