Monterey getting localhost to connect error

Viewed 6232

Just updated to Monterey and getting localhost to connect gives this error:

This site can’t be reached localhost refused to connect

Following excellent guides with brew I have installed httpd And running this command in MacOS Terminal

brew services restart httpd

returns

==>Successfully stopped `httpd` (label: homebrew.mxcl.httpd)
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)

but then connecting to: http://localhost:8080/ gives the error above thank you

2 Answers

I add this in case it helps someone... The real issue was that all of the move from Apple provided Apache to Apache installed by brew was not complete and so page only showed if Moneterey Apache was running Simple solution was to complete configuration of httpd file and restart Mac ~ then all fell in to line: To test the location of Apache/httpd from Terminal run:

which httpd

Homebrew location is:

/usr/local/bin/httpd

If you are getting the default macOS location of

/usr/sbin/httpd

Restart the computer and try the location test again. My thanks to WP Beaches for this

More experimentation - it seems that I have to restart OS Monterey everytime I change httpd.conf A simple Brew restart httpd doesn't appear to reload the configuration

Final insight - using the brew suggested links to phpmyadmin results in a 404 error - without the brew alias as below - it works fine:

    Alias /phpmyadmin /usr/local/share/phpmyadmin
<   Directory /usr/local/share/phpmyadmin/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        <IfModule mod_authz_core.c>
            Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            Order allow,deny
            Allow from all
        </IfModule>
    </Directory>

You give no indication that you're changing httpd's ports anywhere, yet you're trying to connect to 8080 - I'd not expect anyone to answer there. Port 80 (the default for http), e.g. http://localhost/ would be a more sensible address to expect an answer on.

Related