I was trying to enable php, mysql, apache on my macbook pro running yosemite. I followed this guide but it doesn't run. What's wrong in setting up a local web server on OS X Please help.....I get an error saying http://localhost/ is not available

Abhimanyus-MacBook-Pro:~ abhimanyuaryan$ cat /etc/hosts
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##       localhost broadcasthost
#::1            localhost  

Abhimanyus-MacBook-Pro:~ abhimanyuaryan$ ls -lad /Library/WebServer/Documents /Library/WebServer/Documents/index*
drwxr-xr-x  8 root  wheel  272 Feb 18 13:29 /Library/WebServer/Documents
-rw-r--r--  1 root  wheel   49 Feb 18 13:29 /Library/WebServer/Documents/index.html
-rw-r--r--  1 root  wheel   67 Jan  6 14:08 /Library/WebServer/Documents/index.html.en

Abhimanyus-MacBook-Pro:~ abhimanyuaryan$ ps aux| grep http
abhimanyuaryan  26010   0.0  0.0  2432772    664 s000  S+   10:21PM   0:00.00 grep http

I had errors in my "private/etc/apache2/httpd.conf " file. To fix that I replaced the old file with a new file. To check if you have errors in httpd.conf file, write the following commands in terminal:

sudo apachectl start  

to start apache server

sudo apachectl configtest

to run test if the file's syntax is alright. If get a return command saying syntax OK. Then file httpd.conf file is alright.

In my case sudo apachectl configtest output:

Abhimanyus-MacBook-Pro:apache2 abhimanyuaryan$ sudo apachectl configtest
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Abhimanyus-MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Otherwise replace the old file with a new file that I provided above.

sudo mv ~/Downloads/httpd.conf  /private/etc/apache2/httpd.conf

i.e. sudo mv [target] [destination]. You can change the target location of you file. If the new file has not been downloaded to Download folder of Home Directory(~).

Once you are done that now follow the instruction written here by etresoft.

. Thanks.

Not the answer you're looking for? Browse other questions tagged .