Can't open localhost

I appear to have successfuly installed Local on my iMac running on Yosemite 10.10.5, created a new test site and have the green button showing alongside, which presumably means everything is okay up to that point. But when I click on the View Site button I get a “Failed to open page” message from Safari telling me that "Safari can’t open the page ‘flywheel-test.dev’ because Safari can’t connect to the server ‘flywheel-test.dev’.

I get the same ‘Can’t connect’ message if I type in the address indicated in the hosts file, namely 192.168.75.100.

I have the PHP version set to 5.6.20, MySQL set to 5.6, and Apache for the Web Server.

I also get the same set of responses if I switch the web server to nginx.

Hope someone can help.

Best wishes
Ken Sheldon

Look at your […]/private/etc/hosts file. Do you have the entry about flywheel-test.dev?

Yes, hosts file is as follows:

As you will see, I also have DesktopServer installed, but that’s not working either. Yet, I have installed a demo version of Mamp Pro and that works fine.

##
# 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 
### Begin DesktopServer - do not edit this and proceeding lines ###
127.0.0.1	test-383.dev
127.0.0.1	kensheldon.dev
127.0.0.1	attheemporium.dev
127.0.0.1	theenglishlibrary.dev
127.0.0.1	bones.dev
127.0.0.1	dynamik-testbed.dev
127.0.0.1	britishgamesclub.dev
127.0.0.1	extender-sandbox.dev
127.0.0.1	sheldon-history.dev
127.0.0.1	foundation.dev
### End DesktopServer - do not edit this and preceeding lines ###
127.0.0.1 Kens-iMac # added by Apache Friends XAMPP
## Local by Flywheel - Start ##
192.168.75.100 flywheel-test.dev #Local Site
## Local by Flywheel - End ##

…and ping 192.168.75.100 resolves?

Normal response, I think.

64 bytes from 192.168.75.100: icmp_seq=0 ttl=64 time=0.445 ms…

— 192.168.75.100 ping statistics —
16 packets transmitted, 16 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.250/0.314/0.445/0.044 ms

Do you have Laravel Valet or another Vagrant setup that has its own DNS server? They handle all *.dev domains by default.

One thing you can do is try a non-.dev domain.

Tried pinging again, after reboot and repairing permissions and that is now not working.

— 192.168.75.100 ping statistics —
14 packets transmitted, 0 packets received, 100.0% packet loss

Have you started Local after rebooting? The Docker Machine may be offline.

Yes, of course, that’s why it wasn’t working.

Not used Laravel and can’t see anything related to Vagrant.

So, I’m back to square one. Could this be a port issue?

Can you try running the following (assuming that Local is in /Applications) and then provide the output?

/Applications/Local\ by\ Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/osx/docker-machine ls

Also

/Applications/Local\ by\ Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/osx/docker-machine inspect local-by-flywheel

The first one returns:

NAME                ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER    ERRORS
local-by-flywheel   -        virtualbox   Running   tcp://192.168.75.100:2376           v1.13.0 

The second:

{
    "ConfigVersion": 3,
    "Driver": {
        "IPAddress": "192.168.75.100",
        "MachineName": "local-by-flywheel",
        "SSHUser": "docker",
        "SSHPort": 59210,
        "SSHKeyPath": "/Users/kensheldon/.docker/machine/machines/local-by-flywheel/id_rsa",
        "StorePath": "/Users/kensheldon/.docker/machine",
        "SwarmMaster": false,
        "SwarmHost": "tcp://0.0.0.0:3376",
        "SwarmDiscovery": "",
        "VBoxManager": {},
        "HostInterfaces": {},
        "CPU": 1,
        "Memory": 1024,
        "DiskSize": 20000,
        "NatNicType": "82540EM",
        "Boot2DockerURL": "file:///Applications/Local by Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/boot2docker.iso",
        "Boot2DockerImportVM": "",
        "HostDNSResolver": false,
        "HostOnlyCIDR": "192.168.75.1/24",
        "HostOnlyNicType": "82540EM",
        "HostOnlyPromiscMode": "deny",
        "UIType": "headless",
        "HostOnlyNoDHCP": false,
        "NoShare": false,
        "DNSProxy": true,
        "NoVTXCheck": false,
        "ShareFolder": ""
    },
    "DriverName": "virtualbox",
    "HostOptions": {
        "Driver": "",
        "Memory": 0,
        "Disk": 0,
        "EngineOptions": {
            "ArbitraryFlags": [],
            "Dns": null,
            "GraphDir": "",
            "Env": [],
            "Ipv6": false,
            "InsecureRegistry": [],
            "Labels": [],
            "LogLevel": "",
            "StorageDriver": "",
            "SelinuxEnabled": false,
            "TlsVerify": true,
            "RegistryMirror": [],
            "InstallURL": "https://get.docker.com"
        },
        "SwarmOptions": {
            "IsSwarm": false,
            "Address": "",
            "Discovery": "",
            "Agent": false,
            "Master": false,
            "Host": "tcp://0.0.0.0:3376",
            "Image": "swarm:latest",
            "Strategy": "spread",
            "Heartbeat": 0,
            "Overcommit": 0,
            "ArbitraryFlags": [],
            "ArbitraryJoinFlags": [],
            "Env": null,
            "IsExperimental": false
        },
        "AuthOptions": {
            "CertDir": "/Users/kensheldon/.docker/machine/certs",
            "CaCertPath": "/Users/kensheldon/.docker/machine/certs/ca.pem",
            "CaPrivateKeyPath": "/Users/kensheldon/.docker/machine/certs/ca-key.pem",
            "CaCertRemotePath": "",
            "ServerCertPath": "/Users/kensheldon/.docker/machine/machines/local-by-flywheel/server.pem",
            "ServerKeyPath": "/Users/kensheldon/.docker/machine/machines/local-by-flywheel/server-key.pem",
            "ClientKeyPath": "/Users/kensheldon/.docker/machine/certs/key.pem",
            "ServerCertRemotePath": "",
            "ServerKeyRemotePath": "",
            "ClientCertPath": "/Users/kensheldon/.docker/machine/certs/cert.pem",
            "ServerCertSANs": [],
            "StorePath": "/Users/kensheldon/.docker/machine/machines/local-by-flywheel"
        }
    },
    "Name": "local-by-flywheel"
}

Interesting, based off of that information that’s odd why you wouldn’t be getting ping responses at 192.168.75.100.

Can you please try the following?

  1. Quit Local if it’s running
  2. Open VirtualBox.app in /Applications
  3. Right-click on the local-by-flywheel VM and go to reset (this is synonymous with restart)
  4. Re-open Local

Went through the restart process, but no change. Still get the same ‘no response from server’ message.

At this point I would try completely removing the VM in VirtualBox.

After that, open up VirtualBox preferences, go to Network » Host-only Networks and remove any unused adapter there. Then, re-open Local and it will create and provision the VM again.

So sorry for the trouble!

Went through the steps outlined but sorry to say nothing has changed.

Is this relevant to the problem? Running apachectl -S in the Terminal returns the following:

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
ServerRoot: "/usr"
Main DocumentRoot: "/Library/WebServer/Documents"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex proxy-balancer-shm: using_defaults
Mutex proxy: using_defaults
Mutex default: dir="/private/var/run/" mechanism=default 
Mutex mpm-accept: using_defaults
PidFile: "/private/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used

With Apache running, it becomes this:

apachectl -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
ServerRoot: "/usr"
Main DocumentRoot: "/Library/WebServer/Documents"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex proxy: using_defaults
Mutex default: dir="/private/var/run/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex proxy-balancer-shm: using_defaults
PidFile: "/private/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used

And checking document roots returns this:

kensheldon$ apachectl -T
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs

The ServerName directive not being set doesn’t matter.

Not being able to bind to port 80 is indeed a blocker. I’ll look into this.

If you have time can you also try nginx and see what the error output is?

Response is exactly the same with both nginx and apache.