PDA

View Full Version : Cannot Access Apache Server




tnsmart
Aug 4, 2009, 05:32 PM
I have been trying to enable the apache server on my computer, but I cannot access it. I have Web Sharing turned on (see attached picture).

But, whenever I click on either link, Safari tells me:
"Safari can’t open the page “http://10.10.10.194/” because Safari can’t connect to the server “10.10.10.194”."

Can anyone help?



angelwatt
Aug 4, 2009, 05:36 PM
Try entering http://localhost/ into the browser location bar to see if it come sup.

tnsmart
Aug 4, 2009, 05:39 PM
Try entering http://localhost/ into the browser location bar to see if it come sup.

No luck. I get the same thing.

nuxx
Aug 4, 2009, 07:16 PM
Take a look at your /etc/hosts file.

In Terminal type

cat /etc/hosts

It should look something like this

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost

Not Available
Aug 4, 2009, 07:59 PM
Try installing MAMP and use http://localhost:8888/. You might not need MAMP, but apparently, the port is necessary.

tnsmart
Aug 4, 2009, 08:12 PM
Take a look at your /etc/hosts file.

In Terminal type

cat /etc/hosts

It should look something like this

That is exactly what it says.

Try installing MAMP and use http://localhost:8888/. You might not need MAMP, but apparently, the port is necessary.

If I can find a way, I prefer to do it the way it's supposed to be done. Why would the port matter?

And when accessing the server, does the server computer go out onto the network that back to the computer, where the server is, or does it just access it itself, without the network? I'm just wondering if it has anything to do with the wireless router. Although, I can't access the server with the network on or off.

Not Available
Aug 4, 2009, 08:44 PM
If I can find a way, I prefer to do it the way it's supposed to be done. Why would the port matter?

There's no way it's supposed to be done. MAMP provides an accessible environment. Also, did you even try writing the port as well? It does make a difference to me. If I don't write it, I don't get any results...

tnsmart
Aug 4, 2009, 08:53 PM
There's no way it's supposed to be done. MAMP provides an accessible environment. Also, did you even try writing the port as well? It does make a difference to me. If I don't write it, I don't get any results...

I did try access http://localhost:8888/ and still got nothing. Is there another port number I should try?

Isn't Apache server support supposed to be built in to Mac OS X?

Thanks for the help.

angelwatt
Aug 4, 2009, 09:14 PM
he built-in Apache uses port 80 by default, but when port 80 is used it shouldn't need to be written explicitly. Have you tried restarting your Mac? Checking that web sharing box should have done the trick. There could be a typo in the httpd.conf file (Apache configuration). Try starting Apache from a Terminal to see any errors,
sudo apachectl -t

Cerebrus' Maw
Aug 4, 2009, 09:16 PM
I'm pretty sure someone had this problem on the OS X forum, and it turned out to be a permissions error....

Might try a MRoogle on it.

tnsmart
Aug 4, 2009, 09:25 PM
I tried restarting my computer, no luck. I just happened to look at the system.log in Console and noticed that every 10 seconds, these four messages appear:

Aug 4 20:22:42 macbook-2 org.apache.httpd[356]: (2)No such file or directory: httpd: could not open error log file /private/var/log/apache2/error_log.
Aug 4 20:22:42 macbook-2 org.apache.httpd[356]: Unable to open logs
Aug 4 20:22:42 macbook-2 com.apple.launchd[1] (org.apache.httpd[356]): Exited with exit code: 1
Aug 4 20:22:42 macbook-2 com.apple.launchd[1] (org.apache.httpd): Throttling respawn: Will start in 10 seconds

What's with that?

And I typed "sudo apachectl -t" into Terminal, and got "Syntax OK".

tnsmart
Aug 4, 2009, 11:03 PM
I solved my problem.

For some reason, I had no folder named "apache2" located at /private/var/log/ like I should have. I checked two other computers and they had it, so I added the folder, and it filled with three files: error_log, access_log, and accept.lock.1467. The console errors went away and I can now access the server fine.

Thanks for the support.

darb10
Sep 8, 2009, 08:01 PM
I solved my problem.

For some reason, I had no folder named "apache2" located at /private/var/log/ like I should have. I checked two other computers and they had it, so I added the folder, and it filled with three files: error_log, access_log, and accept.lock.1467. The console errors went away and I can now access the server fine.

Thanks for the support.

I know this thread is a month old, but I just wanted to add a thanks, because this ended up being the solution to my problem as well. However, while I added the folder, apache2, I just waited a few moments and the files were created automatically. No need to make them manually.

tnsmart
Sep 9, 2009, 12:27 AM
I know this thread is a month old, but I just wanted to add a thanks, because this ended up being the solution to my problem as well. However, while I added the folder, apache2, I just waited a few moments and the files were created automatically. No need to make them manually.

Glad it solved your problem. That was the same with me. The files were created automatically, I only added the folder.