0

My objective is to create 2 sites site1.example.com and site2.example.com in two VirtualHosts and use /etc/hosts for resolving.The problem is that I can access the main domain example.com but none of the two subdomains. My hosts records: 127.0.0.1 site1.example.com www.site1.example.com example.com www.example.com.

VirutalHost for site1.example.com

DocumentRoot "/var/www/example/site1.example.com/html"
ServerName site1.example.com
DirectoryIndex index.html`

VirtualHost for exmaple.com

DocumentRoot "/var/www/exmaple/html"
ServerName exmaple.com
DirectoryIndex index.html`

I've also tried without the main domain, make 'site1', 'site2', and 'exmaple' in three separete folders, configure hosts only with the 'siteX.exmaple.com but still doesn`t work.No errors in the log, permissions and SELiunx are set correctly I have not tried with proper DNS daemon.

I think the problem is in my /etc/hosts configuration and the two dots in siteX.exmple.com is not interpreted as a single record.

(The same questions on ServerFault does not help)

4
  • 1
    There are a lot of spelling mistakes in that question. Are these typos reflected in the real situation, because if so that's likely why it's not working. If not, please fix your question to match reality. Jul 4, 2020 at 17:52
  • I don't see a configuration for site2.ex[am][ma]ple.com in your question. Is there one? If not, that'll be why it's not working. Jul 4, 2020 at 17:53
  • I've omitted the config for the second one because it is the same as the first
    – Angel
    Jul 4, 2020 at 22:25
  • Your question didn't say so, so I couldn't have known that Jul 4, 2020 at 22:33

1 Answer 1

0

You don't have a virtual host configuration for your target subdomain site1.example.com. what you do have is a sure definition for site1.exmaple.com.

Fix the spelling errors and the problem should resolve itself.

You also don't seem to have any definition at all for site2.example.com.

2
  • The VirtualHost configuration for example.com and site1.example.com is the same and I have no problem with example.com so what do you mean by definition
    – Angel
    Jul 5, 2020 at 8:50
  • 1
    You've got spelling mistakes. If that's the same as in your real situation then that is why it doesn't work, and there's no point anyone looking for anything different. Provide real data if you've got a real data problem. Jul 5, 2020 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .