logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: New to Apache/OS X. Apache not configured correctly.
Author
AegisKleais



Joined: 01 Feb 2015
Posts: 1
Location: USA

PostPosted: Sun 01 Feb '15 19:11    Post subject: New to Apache/OS X. Apache not configured correctly. Reply with quote

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:

<VirtualHost :80>
DocumentRoot "/Users/[username]/Server/web/localhost"
ServerName localhost
ServerAlias localhost
</VirtualHost>
<VirtualHost :80>
DocumentRoot "/Users/[username]/Server/web/com.example
ServerName example.dev
ServerAlias example.dev *.example.dev
</VirtualHost>


Also, in httpd.conf, I changed the DocumentRoot variable:
DocumentRoot "/Users/[username]/Server/web"

<Directory "/Users/[username]/Server/web">
...
</Directory>

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.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 04 Feb '15 18:10    Post subject: Reply with quote

you can use

Code:
ps -ax | grep "httpd"


to see if apache is running

Also a good reference is https://wiki.apache.org/httpd/DistrosDefaultLayout#Mac_OS_X_.28Leopard.2C_Apache_httpd_2.2.29:

So check your config use

Code:

sudo /usr/sbin/httpd -S
Back to top


Reply to topic   Topic: New to Apache/OS X. Apache not configured correctly. View previous topic :: View next topic
Post new topic   Forum Index -> Apache