Estoy perplejo sobre el problema que estoy teniendo y realmente agradecería ayuda para resolverlo.
Tengo un iMac con Mac OS X Mavericks 10.9.2
He configurado mi apache para servir documentos desde el servidor raíz / Volumen / sitios /
Estoy usando hosts virtuales dinámicos, así que solo agregando un directorio con el sufijo * .dev, se convierte en un host virtual.
Mi archivo de hosts es 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
Mi archivo httpd-vhosts.conf es el siguiente:
#
# 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/
Todo esto funcionó. Y no he cambiado nada en mi archivo httpd.conf.
Sin embargo, no puedo cargar localhost
Tampoco puedo cargar 127.0.0.1
Ejecuté el comando sudo lsof -i :80 | egrep "PID|LISTEN"para ver si algún PID estaba escuchando en el puerto 80. Los resultados estaban vacíos.
He intentado reiniciar Apache y también detener y luego iniciar Apache usando
sudo apachectl stop
sudo apachectl start
sudo apachectl restart
Nada funciona.
Verifiqué si Apache se estaba ejecutando emitiendo el comando httpd -v
El regreso fue:
Server version: Apache/2.2.26 (Unix)
Server built:   Dec 10 2013 22:09:38
Intenté conectarme a localhost y 127.0.0.1 a través de la línea de comando con el siguiente 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 ayuda.

Respuestas:
Tuve el mismo problema Eliminé una de las carpetas de mi proyecto y se rompió. En este caso, las configuraciones del sitio deben eliminarse de httpd-vhosts.conf y httpd.conf.
Tratar
ping 127.0.0.1apachectl configtestpuede ayudarte a detectar el problema.fuente
apachectl configtestdebes ser tu primer intento! Gracias.sudo cd / && grep -rn "/Users/me/blah/blah" *El problema podría ser que el archivo de hosts podría estar dañado por la codificación ASCII original. Limpié todos los espacios y puse pestañas en él, ejecuté
sudo killall -HUP mDNSResponder(puede hacer eso en lugar de reiniciar) y después, funcionó.fuente
/etc/hostsestaba dañado: líneas duplicadas, algunos espacios donde antes había pestañas ... ahora para descubrir cómo sucedió eso ...En mi caso, el problema fue que la carpeta / private / var / log / apache2 / desapareció por razones desconocidas. Recreándolo con
y reiniciando apache con
hecho el truco!
fuente
Las conexiones rechazadas son causadas más comúnmente por un servidor que no está escuchando el puerto.
Los errores de sintaxis o los errores generales del archivo de configuración matarán a Apache al inicio (generalmente sin informar a los registros de errores o al terminal).
Intente ejecutar
sudo apachectl configtesty ver si genera algún mensaje de error.fuente
Es específico de Mac. Primero tienes que habilitar el uso compartido web. Para Maveric se puede hacer como en este tutorial. https://www.youtube.com/watch?v=TgiZiTU9JVY Segundo, para Mac, el tráfico se filtra a través de pfctl (es decir, man pfctl) en Maveric e ipfw (man ipfw) para la versión anterior de Mac OS si necesita más que un puerto 80
fuente
Esto podría ayudar con su consulta. http://mallinson.ca/web-development-with-mavericks/
fuente