Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tnsmart

macrumors 6502
Original poster
Aug 23, 2008
279
24
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?
 

Attachments

  • Picture 2.png
    Picture 2.png
    75.8 KB · Views: 141
Take a look at your /etc/hosts file.

In Terminal type

Code:
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
 
Take a look at your /etc/hosts file.

In Terminal type

Code:
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.
 
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...
 
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.
 
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,
Code:
sudo apachectl -t
 
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".
 
Resolution

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 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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.