Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

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

reinstall apache2

Hey, I was trying to set up apache to test web work on localhost, and now apache will not connect to localhost at all. Is there any way to restore apache to factory new to start over? I don't have time machine, and I would rather not reinstall all of OS X.


Also, what is the difference between /etc/apache2 and /private/etc/apache2? Googling how to set up apache on Mountain Lion, there is some info that references one, some the other. None helped me get apache running he way I wanted, just got it to where it won't connect to localhost at all, must less localhost/~myusername

MacBook Pro, OS X Mountain Lion (10.8.2)

Posted on Jan 28, 2013 7:01 PM

Reply
Question marked as Best reply

Posted on Jan 29, 2013 11:40 AM

The /private/etc folder is the same folder. /etc is an alias or a symbolic link to /private/etc.


You just need to restore the contents of /etc/apache2/httpd.conf and /etc/apache2/extra/ with the contents of /etc/apache2/originals/


In terminal, like this. (4 commands)


sudo serveradmin stop web

sudo cp /etc/apache2/originals/httpd.conf /etc/apache2/

sudo cp /etc/apache2/originals/extra /etc/apache2/

sudo serveradmin start web


If this doesn't work, the likely there's other issues at play.


HTH


-Graham


***edit***

Oh! Don't mess with the config files. The GUI doesn't like it! If you have to use the terminal you should make as many changes as possible in the GUI first. ONLY THEN change the config files. Abandon the GUI completely after that. Changes made here will mess up your command line work.

3 replies
Question marked as Best reply

Jan 29, 2013 11:40 AM in response to JeffSharps

The /private/etc folder is the same folder. /etc is an alias or a symbolic link to /private/etc.


You just need to restore the contents of /etc/apache2/httpd.conf and /etc/apache2/extra/ with the contents of /etc/apache2/originals/


In terminal, like this. (4 commands)


sudo serveradmin stop web

sudo cp /etc/apache2/originals/httpd.conf /etc/apache2/

sudo cp /etc/apache2/originals/extra /etc/apache2/

sudo serveradmin start web


If this doesn't work, the likely there's other issues at play.


HTH


-Graham


***edit***

Oh! Don't mess with the config files. The GUI doesn't like it! If you have to use the terminal you should make as many changes as possible in the GUI first. ONLY THEN change the config files. Abandon the GUI completely after that. Changes made here will mess up your command line work.

Jan 30, 2013 12:50 PM in response to gracoat

I can't see anywhere in the GUI to change anything to do with apache, that would be awesome. Is ther such an thing and if so where???



there was no serveradmin command on my machine, so i stopped apache with apachectl


but I copied the files from original folder and the restarted apache


but still couldn't get to localhost.


I looked at error_log and access_log in /var/log/apache2 the last entries were from Dec 2012, but nothing in them ecxcept things like a missing favicon.


So I look into apachectl to see if i could find anything and apachectl -t led me to a syntax error in a conf file in the /etc/apache2/users/ folder. It was a typo, <Direcory> instead of <Directory>


Once I fixed that I can at least see localhost, although what I wanted to do was set up a few vhosts and I'll probably break this again trying to do that unless Apple has a GUI for that.

reinstall apache2

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