Cannot Access Apache Server

Discussion in 'Web Design and Development' started by tnsmart, Aug 4, 2009.

  1. tnsmart macrumors 6502

    Joined:
    Aug 23, 2008
    #1
    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?
     

    Attached Files:

  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    Try entering http://localhost/ into the browser location bar to see if it come sup.
     
  3. tnsmart thread starter macrumors 6502

    Joined:
    Aug 23, 2008
    #3
    No luck. I get the same thing.
     
  4. nuxx macrumors member

    nuxx

    Joined:
    Jun 5, 2007
    Location:
    Tokyo
    #4
    Take a look at your /etc/hosts file.

    In Terminal type

    Code:
    cat /etc/hosts
    It should look something like this

     
  5. Joined:
    Jun 30, 2009
    #5
    Try installing MAMP and use http://localhost:8888/. You might not need MAMP, but apparently, the port is necessary.
     
  6. tnsmart thread starter macrumors 6502

    Joined:
    Aug 23, 2008
    #6
    That is exactly what it says.

    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.
     
  7. Joined:
    Jun 30, 2009
    #7
    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...
     
  8. tnsmart thread starter macrumors 6502

    Joined:
    Aug 23, 2008
    #8
    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.
     
  9. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #9
    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
     
  10. Cerebrus' Maw macrumors 6502

    Joined:
    Mar 9, 2008
    Location:
    Brisbane, Australia
    #10
    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.
     
  11. tnsmart thread starter macrumors 6502

    Joined:
    Aug 23, 2008
    #11
    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".
     
  12. tnsmart thread starter macrumors 6502

    Joined:
    Aug 23, 2008
    #12
    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.
     
  13. darb10 macrumors newbie

    Joined:
    Sep 8, 2009
    #13
    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.
     
  14. tnsmart thread starter macrumors 6502

    Joined:
    Aug 23, 2008
    #14
    Glad it solved your problem. That was the same with me. The files were created automatically, I only added the folder.
     

Share This Page