Why are apache subdominios sending to the default site?

Asked

Viewed 80 times

0

Today I have a PHP system that uses an IP, so it looks like this:

http://200.204.203.345/system

I’m setting up subdominios to answer the requests and stay that way

http://sistema1.empresa.com.br

http://sistema2.empresa.com.br

It turns out that the browser always goes to the main site, does not obey the subdomains... I already have these settings on other servers, but this insists not to obey

The only thing that is different is that on the other servers I delete the main site because I only use subdomains, the main site is hosted on other servers and the subdomains comes through A entries in DNS

This also turns by DNS entries, but for now I can not delete the main site... how to make him understand that there are subdomains?

The file 000-default.conf is like this:

<VirtualHost *:80>
 ServerAdmin [email protected]
        DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
  • Your Virtualhot has nothing configured besides the /var/www/html folder, there is no way to know if it is using virtualhost+/etc/hosts or if it is solving this in PHP, more details.

  • I thought the problem was the default setting, but I was making a crude mistake... you know when it makes you want to kick everything... it’s not possible that I lost hours on it... follow the solution in the answer, it’s even embarrassing :)

  • Dear Marcelo, it’s not really a solution, since the question did not have this part mentioned and would have no other answer. Forgive me, but it is "typo" (confusion) only. But I’m glad you managed to solve it by yourself.

  • 1

1 answer

0

I was making a banal mistake...

I was just changing:

<VirtualHost sistema.empresa.com.br>
DocumentRoot /home/empresa/subdominios/clientes
ServerName sistema.empresa.com.br
...

for

<VirtualHost *>
DocumentRoot /home/empresa/subdominios/clientes
ServerName sistema.empresa.com.br
...

All right now

Browser other questions tagged

You are not signed in. Login or sign up in order to post.