Estou perplexo com o problema que estou tendo e realmente aprecio a ajuda para resolvê-lo.
Eu tenho um iMac executando o Mac OS X Mavericks 10.9.2
Configurei o meu apache para servir documentos a partir da raiz do servidor / Volume / sites /
Estou usando hosts virtuais dinâmicos, portanto, apenas adicionando um diretório com o sufixo * .dev, ele se torna um host virtual.
Meu arquivo hosts é bastante básico:
##
# 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
Meu arquivo httpd-vhosts.conf é o seguinte:
#
# 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/
Tudo isso funcionou. E eu não mudei nada no meu arquivo httpd.conf.
No entanto, não consigo carregar o host local
Também não consigo carregar 127.0.0.1
Executei o comando sudo lsof -i :80 | egrep "PID|LISTEN"
para verificar se algum PID estava escutando na porta 80. Os resultados estavam vazios.
Eu tentei reiniciar o apache e também parar e iniciar o apache usando
sudo apachectl stop
sudo apachectl start
sudo apachectl restart
Nada funciona.
Eu verifiquei se o apache estava em execução emitindo o comando httpd -v
O retorno foi:
Server version: Apache/2.2.26 (Unix)
Server built: Dec 10 2013 22:09:38
Eu tentei conectar ao localhost e 127.0.0.1 através da linha de comando com o seguinte resultado:
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 ~
Por favor ajude.