I am perplexed about the problem I am having and would really appreciate help resolving it.
I have an iMac running Mac OS X Mavericks 10.9.2
I have set up my apache to serve documents from the server root /Volume/sites/
I am using Dynamic Virtual hosts, so just by adding a directory with the *.dev suffix, it becomes a virtual host.
My hosts file is pretty basic:
## # 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
My httpd-vhosts.conf file is as follows:
# # Virtual Hosts # # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.2/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # NameVirtualHost *:80 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # #allow access to the Hosts directory where your sites are <Directory "/Volumes/sites"> Options Indexes FollowSymLinks MultiViews AllowOverride All #you could configure the following to only allow access from localhost Order allow,deny Allow from all </Directory> #get the server name from the Host: header UseCanonicalName Off VirtualDocumentRoot /Volumes/sites/%0/
This all worked. And I have not changed anything in my httpd.conf file.
Yet I can't load localhost
I also cannot load 127.0.0.1
I ran the command
sudo lsof -i :80 | egrep "PID|LISTEN" to see if any PID was listening on port 80. The results were empty.
I have tried to restart apache and also to stop and then start apache using
sudo apachectl stop
sudo apachectl start
sudo apachectl restart
I checked if apache was running by issuing the command
The return was:
Server version: Apache/2.2.26 (Unix) Server built: Dec 10 2013 22:09:38
I tried to connect to localhost and 127.0.0.1 via the command line with the following result:
alisamii at alisamii in ~ $ telnet localhost 80 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused Trying fe80::1... telnet: connect to address fe80::1: Connection refused telnet: Unable to connect to remote host alisamii at alisamii in ~ $ telnet 127.0.0.1 80 Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host alisamii at alisamii in ~ $ lynx http://localhost Looking up localhost Making HTTP connection to localhost Alert!: Unable to connect to remote host. lynx: Can't access startfile http://localhost/ alisamii at alisamii in ~ $ lynx http://127.0.0.1 Looking up 127.0.0.1 Making HTTP connection to 127.0.0.1 Alert!: Unable to connect to remote host. lynx: Can't access startfile http://127.0.0.1/ alisamii at alisamii in ~