0

I get a 404 error message when I try localhost or 127.0.0.1. This is also true if I try localhost/~username I assume apache is running or I would not get 404. I have stopped and started and restarted apache.

hosts file looks like this:

name: localhost
ipv6_address: ::1

name: localhost
ip_address: 127.0.0.1

httpd.conf show this as DocumentRoot

DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">

$ ps -ax | grep '[h]ttpd' gives:

12912 ??         0:00.79 /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/apache2/httpd.conf
xxx-MacBook-Air:/ myusername$ ps -ax | grep '[h]ttpd'

The error log at var/log/apache2 is empty. Well iow that directory is empty.

Finally, this is the 404 message:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Site Not Found</title>

    <meta name="viewport" content="width=device-width, initial-scale = 1.0; maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="//fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet" type="text/css">
    <link href="/local-error-page-assets/errors.css" rel="stylesheet" type="text/css">
</head>

<body class="error">
<div class="layout">
    <div class="layout__content">
        <div class="kitchensink text-center">
            <p class="error-code">404</p>
            <h1>Site Not&nbsp;Found</h1>
            <hr />
            <p>The site you requested does not have an associated route in Local.<br /><strong>If you continue to get this message after refreshing, try restarting the Local site.</strong></p>
            <p>If the error persists, check the Local Router Logs in Local by going to<br />Help &raquo; Reveal Local Router's Logs.</p>
        </div>

        <img src="/local-error-page-assets/local-gray.svg" />
    </div>
</div>
</body>
</html>

if I click on a link in the source like:

<link href="/local-error-page-assets/errors.css" rel="stylesheet" 

it serves up the css no problem from this address:

http://localhost/local-error-page-assets/errors.css

I can't find "error.css" anywhere on my computer. Does it exist? I thought if I could find that file I would know where the server really was looking.

Any ideas? Thanks

6
  • It's been a while since I have fiddles with Apache on macOS but I thought that the default document root (if you have made no changes) was not at the System-level /Library/Webserver/Documents but at the user level: "~/Libarary/Webserver/Documents" I remember running into this once or twice but don't recall how I fixed it. Check there and see if that is of any help... – Steve Chambers Jan 28 '20 at 14:01
  • The hosts file you mention at the top: Would this be /etc/hosts? – nohillside Jan 28 '20 at 16:48
  • there is no Webserver folder at the user Library level. There is a folder called Local Sites one level under user – Johnnyboy Gomez Jan 28 '20 at 18:36
  • RE: Does this answer your question? I can’t connect to localhost on Mac high Sierra: I did the first two tests. All good. But when I run ps -ax | grep '[h]ttpd' I get no reply form the server – Johnnyboy Gomez Jan 28 '20 at 18:38
  • RE: the hosts file you mention. es it is etc/hosts – Johnnyboy Gomez Jan 28 '20 at 18:40

Browse other questions tagged .