-2

I have a site working on a VM with Debian and Apache. The site is sitename.example.com . Now, I need to add a subdomain like subdomain.sitename.example.com on the same IP.

What have I done until now:

000-default.conf

<VirtualHost 192.167.102.49:80>

ServerAdmin webmaster@localhost
DocumentRoot /home/iamanuser/www/subdomain/public_html
ServerName subdomain.sitename.example.com
ServerAlias subdomain.example.com

</VirtualHost>

apache2.conf

<Directory /home/iamanuser/www/subdomain/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost 192.167.102.49:80>
ServerName www.subdomain.sitename.example.com
DocumentRoot /home/iamanuser/www/subdomain/public_html
</VirtualHost>

etc/hosts

192.167.102.49 sitename.example.com
192.167.102.49 subdomain.sitename.example.com

sitename.example.com works perfect, but everytime I go for subdomain.sitename.example.com the DNS can't be resolved. I'm literally going crazy, please help me. Thanks in advance.

Jenny D
  • 28,400
  • 21
  • 80
  • 117

2 Answers2

1

Are you trying to access this from the machine that has these entries in /etc/hosts?

You might also want to check /etc/nsswitch.conf to check that 'hosts' comes before 'dns' etc.

You can use getent hosts subdomain.sitename.domain.com to see what would be returned to an application when it does a lookup (do this from your [Linux] client)

Cameron Kerr
  • 4,239
0

chrome is known for ignoring /etc/hosts file.

There's an answer on superuser that tells you how to fix that:

- Go to chrome://settings

- Click on "Show advanced settings..."

- Unmark the Predict network actions to improve page load performance box.

- Check if the DNS prefetching is really disabled by going to 
chrome://dns. You should see there something like DNS 
pre-resolution and TCP pre-connection is disabled. If the 
prefetching is not disabled, you'll see some tables there.
umläute
  • 541