Como posso vincular example.com para ser atendido pelo apache, estou executando localmente na máquina para fins de desenvolvimento?
Eu tentei adicionar isso no meu arquivo / etc / hosts
127.0.0.1 example.com
e recarregou o apache2 sudo /etc/init.d/apache2 reload
, mas isso não funcionou.
Eu adicionei os hosts virtuais para example.com
e também os habilitei por a2ensite
Editar:
Log de erros do Apache (Nada relacionado, até onde eu sei)
[Mon Mar 28 15:21:01 2011] [notice] Apache/2.2.16 (Ubuntu) configured -- resuming normal operations
[Mon Mar 28 15:21:03 2011] [notice] Graceful restart requested, doing restart
[Mon Mar 28 15:21:03 2011] [notice] Apache/2.2.16 (Ubuntu) configured -- resuming normal operations
[Mon Mar 28 15:21:23 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Mon Mar 28 15:21:23 2011] [error] [client 127.0.0.1] File does not exist: /var/www/favicon.ico
[Mon Mar 28 15:35:34 2011] [error] [client 127.0.0.1] File does not exist: /var/www/phpmyadmin
[Mon Mar 28 15:36:48 2011] [notice] caught SIGTERM, shutting down
[Mon Mar 28 15:36:49 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 28 15:49:13 2011] [notice] Graceful restart requested, doing restart
[Mon Mar 28 15:49:13 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 28 15:49:17 2011] [notice] caught SIGTERM, shutting down
[Mon Mar 28 15:49:18 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 28 15:50:24 2011] [notice] Graceful restart requested, doing restart
[Mon Mar 28 15:50:24 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 28 16:15:09 2011] [notice] Graceful restart requested, doing restart
Warning: DocumentRoot [/home/ashfame/www/example.com/] does not exist
(2)No such file or directory: apache2: could not open error log file /home/ashfame/www/example.com/error.log.
Unable to open logs
[Mon Mar 28 16:46:18 2011] [warn] pid file /var/run/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Mar 28 16:46:18 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 28 16:46:25 2011] [error] [client 127.0.0.1] File does not exist: /var/www/example.com
[Mon Mar 28 16:46:38 2011] [error] [client 127.0.0.1] File does not exist: /var/www/www
[Mon Mar 28 16:55:48 2011] [error] [client 127.0.0.1] File does not exist: /var/www/phpbb/phpbb
[Mon Mar 28 17:17:40 2011] [notice] caught SIGTERM, shutting down
[Mon Mar 28 17:17:41 2011] [notice] Apache/2.2.16 (Ubuntu) PHP/5.3.3-1ubuntu9.3 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 28 17:19:29 2011] [error] [client 127.0.0.1] File does not exist: /var/www/example.com
Também tento fazer wget --spider http://example.com
, o que mostra que o arquivo de hosts está funcionando, mas no navegador ele abre link
ashfame@ashfame-desktop:/usr/sbin$ wget --spider http://example.com
Spider mode enabled. Check if remote file exists.
--2011-03-28 17:20:57-- http://example.com/
Resolving example.com... 127.0.0.1
Connecting to example.com|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Remote file exists and could contain further links,
but recursion is disabled -- not retrieving.
Arquivo de configuração do host virtual:
# Place any notes or comments you have here
# It will make any customization easier to understand in the weeks to come
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin [email protected]
ServerName www.example.com
ServerAlias example.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html
DocumentRoot /home/ashfame/www/example.com/
# Custom log file locations
LogLevel warn
ErrorLog /home/ashfame/www/example.com/error.log
CustomLog /home/ashfame/www/example.com/access.log combined
</VirtualHost>