U
U
uranus2352014-10-17 22:02:09
Apache HTTP Server
uranus235, 2014-10-17 22:02:09

Why does www.domain.com work and domain.com not?

Redirected my domain using A records to my VPS:
domain.com A 5.175.132.61
*.domain.com A 5.175.132.61
www.domain.com CNAME domain.com
The server has the following Apache configuration:
NameVirtualHost 5.175.132.61:80
NameVirtualHost 5.175.132.61:443
NameVirtualHost 5.175.132.61
DocumentRoot /var/www/domain.com/
ServerName www.domain.com
ServerAlias ​​domain.com www.domain.com
When browsing to www.domain.com shows files from the /var/www directory /domain.com/, and when you go to domain.com it shows the apache test page :(

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Petrikov, 2014-10-18
@uranus235

ServerAlias ​​domain.com - remove www.domain.com. (In general, show the entire virtual host config, maybe something is not in its place). Well, or any redirect option: www.cyberforum.ru/apache/thread653394.html

A
Anton Starostin, 2014-10-17
@Lixoradka

I'm not sure about Apache, but on IIS this problem occurs when there is no binding for the address with www.
In other words, for a web server, the addresses www.domain.com and domain.com are completely different and you need to bind them to a specific site separately each. I'm not sure that helped, but I hope that the direction gave a successful one.

I
Igor, 2014-10-17
@merryjane

Show the output of the command:
apachectl -S

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question